int main(void)
{
char s[70];
FILE *fp;
fp=fopen("123.txt","r");
if((fp=fopen("123.txt","w"))==NULL) //if 语句就是创建了一个空的.txt文件
{
printf("Open the file failure...
");
exit(0);
}
while(1)
{
printf("Input a string...
s=");
if(gets(s),strlen(s)<70)
break;
printf("Too long, redo: ");
}
fputs(s,fp);
fclose(fp);
printf("
");
return 0;
}