69,371
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i = 0;
FILE *fp;
char max[50] = { 0 };
if((fp = fopen("kiss.txt", "a+"))==NULL)
{
printf("打开错误\n");
}
printf("Re Input: ");
gets(max);
fprintf(fp, "%s", max);
//好好体会下缓冲,和文件指针的位置。下面两句有一条,程序都是对的。不刷新的话,就把指针指到文件开头
fflush(fp);
//rewind(fp);
fscanf(fp,"%s",max);
puts(max);
puts("**********");
fclose(fp);
return 0;
}