问题
填空题
用以下程序把从键盘输入的字符存放到一个文件中,用字符#作为结束符,请按题意要求填空完善程序。 #include<stdio.h> main() { FILE*fp; char ch,fname[10]; printf("Input the name of file\n"); gets(fname); if(fp=fopen( 【18】 ))==NULL) {printf("can’t open\n"); 【19】 ; } while((ch=getchar())!=’#’) fputc( 【20】 ); fclose(fp); }
答案
参考答案:[18]fname,"#"
解析:[19]exit(0)[20]ch,fp