C/C++ 删除文件 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;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章