填空题

以下程序由终端键盘输入一个文件名,然后把从终端键盘输入的字符依次存放到该文件中,用#作为结束输入的标志,请填空。
#include<stdio.h>
main()
FILE *fp;
char ch,fname[10];
printf("Input the nam \n");
gets(fname);
if((fp= 【17】 ==NULL)
printf("Cannot open\n"); exit(0);
printf("Enter data\n");
while(ch=getchar()!=’#’)
fputc( 【18】 ,fp);
fclose(fp);

【参考答案】

[AG] fopen(fname, "w")
[AH] ch