1
1[此贴子已经被作者于2005-5-31 21:21:52编辑过]
[此贴子已经被作者于2005-5-31 21:22:17编辑过]
有几个地方的fpa,fpb 搞混了,putchar(fgetc(fb))你还有个括号没括!程序如: #include "stdio.h" main() { FILE *fpa,*fpb; if((fpa=fopen("a.txt","r"))==NULL) {printf("error1a");exit(0);} if((fpb=fopen("b.txt","w"))==NULL) {printf("error1b");exit(0);}
while(!feof(fpa)) fputc(fgetc(fpa),fpb);
if(fclose(fpa)||fclose(fpb)){printf("error2a'or'b");exit(0);}
if((fpb=fopen("b.txt","r"))==NULL) {printf("error1b");exit(0);}
while(!feof(fpb)) putchar(fgetc(fpb)); if(fclose(fpa)){printf("error2b");exit(0);}
}