填空题 以下程序由终端键盘输入一个文件名,然后把终端键盘输入的字符依次存放到该文件中,用#号作为结束输入的标志。请填空。 #include<stdio.h> #include<stdlib.h> main() { FILE*fp; char ch, fname[10]; printf("Enter the name of file/n"); gets(fname); if((fp=______)==NULL){printf("Open error/n"); exit(0); } printf("Enter data: /n"); while((ch=getchar())!='#') fputc(______, fp); fclose(fp); }
  • 1、
【正确答案】 1、fopen(fname, "w") ch    
【答案解析】