【发布时间】:2011-09-17 19:01:22
【问题描述】:
如何删除目录中的所有文件?我使用了 rmdir 和互联网上建议的其他方法,但没有人帮助我:这是其中之一:(我想删除当前工作目录中的目录 tmp)
removeDir()
{
char currentPath[_MAX_PATH];
GetCurrentPath(currentPath);
std::string tmp(currentPath);
string path = tmp + "\\temp";
std::string command = "del ";
std::string Path = path + "1.txt";
cout << Path << endl;
system(command.append(Path).c_str());
}
GetCurrentPath(char* buffer)
{
getcwd(buffer, _MAX_PATH);
}
【问题讨论】: