程序老是出错,运行不了
#include <stdio.h>int main()
{
FILE *fp1,*fp2;
char str[128];
if ((fp1=fopen("test1.txt","r"))==NULL)
{
printf("cannot open file\n");
exit(0);
}
if ((fp2=fopen("test2.txt","w"))==NULL)
{
printf("cannot open file\n");
exit(0);
}
while (fgets(str,128,fp1)>0)
{
fputs(str,fp2);
printf("%s",str);
}
fclose(fp1);
fclose(fp2);
return 0;
}
[此贴子已经被作者于2015-11-21 12:24编辑过]