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 }
謝謝支援!
可以聯系我進行交流。[email protected]
2015.3.27
22:30
留待後查,同時友善他人