#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
FILE *fp;
char a[][8]={"Apple","Grape","Pear"};
char *aa="";
int i;
if((fp=fopen("f11.txt","w"))==NULL)
{
printf("can not open the file!\n");
exit(0);
}
for(i=0;i<3;i++)
fputs(a[i],fp);
fclose(fp);
if((fp=fopen("f11.txt","r"))==NULL)
{
printf("can not open the file\n");
exit(0);
}
i=0;
while(!feof(fp))
{if(fgets(aa,strlen(a[i++]+1),fp)!=NULL)
puts(aa);
}
fclose(fp);
return 0;
}
问题很可能是红色那块
因为把红色那注释了后就没出现问题