if((fp=fopen(____"W+"))==NULL)
{"prinff(" - 高级语言程序设计(一)(00342) - 专业知识收录平台">
if((fp=fopen(____"W+"))==NULL)
{"prinff(" - 高级语言程序设计(一)(00342) - 专业知识收录平台">
以下程序中用户由键盘输入一个文件名,然后输入一串字符(用#结束输入)存放到此文件中,形成文本文件,并将字符的个数写到文件的尾部,请填空。
#include
main()
{FTLE,*fp;
charch,fname[32];intcount=0;
prinff("Inputthefilename:");seanf("%s",fname);
if((fp=fopen(____"W+"))==NULL)
{"prinff("Can'topenfile:%s\n",fname);exit(0);}
prinff("Enterdata;\n");
while((ch=getchar())!='#'){fputc(ch,fp);count++;}
fprintf(____,"\n%d\n",count);
fclose(fp);
}
fllame; fp
扫描二维码免费使用微信小程序搜题/刷题/查看解析。
版权声明:本文由翰林刷题小程序授权发布,如需转载请注明出处。