有关文件的问题
#include<stdio.h>#include<stdlib.h>
int main()
{
FILE *fp;
char ch[20];
if((fp=fopen("ch","a+"))==NULL)
{
printf("open error,I m vevy sorrow.\n");
exit(1);
}
puts("I want you enter the word to the file.\n");
while(gets(ch)!=NULL&&ch[0]!='\0')
fprintf(fp,"%s",ch);
puts("file over");
rewind(fp);
while((fscanf(fp,"%s",ch))==1)
puts(ch);
if(fclose(fp)!=0)
fprintf(stderr,"wrong\n");
return 0;
}调试和编译都通过了,为什么结果不正确啊,请大家帮忙看下,