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