C/C++ 删除文件 remove函数


  头文件:#include <stdio.h> //C

      #include <cstdio> //C++

  函数原型:int remove(const char * filename);

  返回结果:如果成功返回 0,失败返回“EOF”( -1)。

 1 #include<iostream>
 2 #include<cstdio>
 3 
 4 using namespace std;
 5 
 6 int main()
 7 {
 8     char *savePath = "/home/zhuwei/contour/linearIteration.shp";
 9         
10     if(remove(savePath)==0)
11     {
12         cout<<"删除成功"<<endl;        
13     }
14     else
15     {
16         cout<<"删除失败"<<endl;        
17     }
18     return 0;
19 }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM