我有這樣的代碼在C++中刪除目錄,其中包括在它的文件中刪除:功能以刪除目錄後,才調試完成C++
void* hFind = INVALID_HANDLE_VALUE;
WIN32_FIND_DATA ffd;
hFind = FindFirstFile((fullpath+"\\" + _docname + "\\"+"*").c_str(), &ffd);
do //delete all the files in the directory
{
// check if it is a file
if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
string s = (fullpath+_docname+"\\").append(ffd.cFileName);
remove(s.c_str());
}
}
while (FindNextFile(hFind, &ffd) != 0);
removeDirectory(fullpath+"\\" + _docname);
FindClose(hFind);
的問題是 - 該目錄實際刪除後,才關閉dubugger。 調試時,該目錄無法訪問,但仍然存在,這使我很煩惱。 你知道我該如何解決它,以tottaly刪除文件夾?
你不應該刪除該目錄之前關閉找到目錄之前關閉句柄? – Mat
我試過了,它沒有奏效......任何其他想法? –
你在'調試'時意味着什麼? – stijn