相关代码 |
|
/* 范例:9-26 */ #include #include void main(int argc,char *argv[]) { if(argc!=2) { printf("Syntax Error!\n\tp9-26 filename"); exit(1); } if((remove(argv[1]))!=-1) printf("Delete %s success!\n",argv[1]); else printf("Cannot delete %s\n",argv[1]); } 程序执行结果:(假设oo.txt为已存在(要删除)的文件名) D:\TC>p9-26 oo.txt Delete oo.txt success!