使用remove函数删除本地文件:
头文件:#include <stdio.h> //C
#include <cstdio> //C++
函数原型:int remove(const char * filename);
返回结果:如果成功返回 0,失败返回“EOF”( -1)。
代码示例:
#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;
}