725
技術社區[雲棲]
C++刪除文件
接著上一篇,如果找到同名文件,則要把同名文件刪除
//deletefile.cpp
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
char *savePath = "/home/zhuwei/contour/linearIteration.shp";
if(remove(savePath)==0)
{
cout<<"刪除成功"<<endl;
}
else
{
cout<<"刪除失敗"<<endl;
}
return 0;
}
編譯:g++ -o deletefile deletefile.cpp
執行:./deletefile
OK,執行通過
最後更新:2017-04-02 00:06:55