#include <stdio.h>
#include <stdlib.h>
//文件的内容复制 int main(int a,char *argv[]){
if(a!=3){
printf("useage:%s source!\n", argv[0]);
exit(1);
}
FILE *fp1, *fp2;
fp1 = fopen(argv[1],"r");
if(fp1==NULL){
printf("source file open error");
exit(1);
}
fp2 = fopen(argv[2],"w");
if(fp2==NULL){
printf("target file open error");
exit(1);
} int ch;
while((ch=fgetc(fp1)) != EOF){
fputc(ch, fp2);
}
//关闭流
if(fclose(fp1)!=0){
printf("source file close error");
}else if(fclose(fp2)!=0){
printf("target file close error");
} return 0; }

  

05-18 10:11