#include <string>
#include <io.h>
//在c++中判断文件是否存在,如存在将其删除
int main()
{
std::string rmseFile = "rmse.txt";
if (_access(rmseFile.c_str(), 0) == 0) //文件存在
{
if (remove(rmseFile.c_str()) == 0)
{
printf("删除成功");
}
else
{
printf("删除失败");
}
}
else
{
printf("没有该文件");
}
}
01-18
5977
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
12-03
671
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交