创建文件
#include <stdio.h> int main(int argc,char *argv[]){ f(argc != 2){
printf("param error"); return 1; }else{ FILE *fd = fopen(*(argv+1),"w+"); if(fd
!= NULL){ printf("%s is created.\n",*(argv+1)); } } return 0; }
编译运行:
~/Desktop/Mc$ gcc create.c -o create ~/Desktop/Mc$ ./create hello.txt
hello.txt is created. wong@wong-computer:~/Desktop/Mc$ ls hello.txt
谢谢阅读。
热门工具 换一换