题目内容
以下程序中用户由键盘输入一个文件名,然后输入一串字符(用#结束输入)存放到此文件文件中形成文本文件,并将字符的个数写到文件尾部,请填空。#include main( ){ FILE *fp;char ch,fname[32]; int count=0;printf("Input the filename :"); scanf("%s",fname);if((fp=fopen([BlankArea1],"w+"))==NULL){ printf("Can't open file:%s \n",fname); exit(0);}printf("Enter data:\n");while((ch=getchar())!="#"){ fputc(ch,fp); count++;}fprintf( fp ,"\n%d\n", count);fclose(fp);}
查看答案
搜索结果不匹配?点我反馈