C語言的文件操作想必大家都多多少少的有所了解,今天為大家獻上刪除文件的操作方法。這裡我們要用到的是remove(const T& x);x使用代表文件路徑及文件名的字符常量來確定需要刪除的對象。下面是源碼:
1 #include <stdio.h>
2
3 int main()
4
5 {
6
7 char a[20];
8
9 printf(“please input a file:”);
10
11 scanf(“%s”,a);
12
13 if(remove(a))
14
15 printf(“Could not delete the file &s \n”,”1.txt”);
16
17 else printf(“OK \n”);
18
19 return 0;
20
21 }
謝謝支持!
可以聯系我進行交流。Renhanlinbsl@163.com
2015.3.27
22:30