![]() |
#2
r3169994432015-12-06 21:29
找到问题了ifs.close(); 要把文件先关闭再删除
|
{
ifstream ifs(PFile2.c_str());
//cout<<PFile.c_str();
if(!ifs)
{
cout<<"未发现文件!\n";
return 0;
}
else
{
cout<<"发现文件!\n";
if(DeleteFile(PFile2.c_str())==0)
{
cout<<"删除失败";
}
//cout<<PFile2.c_str();
return 1;
}
}
DeleteFile()返回值为0,头大了!
[此贴子已经被作者于2015-12-6 20:53编辑过]