windows vc6.0++通过。
功能:输入字符串,写入t.txt并显示在屏幕上
#include<stdio.h>
#include<string.h>
main()
{
char str[80],str1[80];
FILE *fp;
if ((fp=fopen("t.txt","w+"))==NULL)
{
printf("Cannot open t.txt!\n");exit(1);
}
gets(str);
fputs(str,fp);
rewind(fp);
fgets(str1,strlen(str)+1,fp);
puts(str1);
fclose(fp);
}