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