第1题 请补充main函数,该函数的功能是:先以只写的方式打开文件“out52.dat”,再把字符str中的字符保存到这个磁盘文件中。
仅在横线上填入所编写的若干表达式或语句,勿改动函数中其他任何内容。
#include
#include
#define N 80
main()
{
FILE *fp;
int i = 0;
char ch;
char str[N] = "I'm a students!";
if ((fp = fopen(___1___)) == NULL)
{
printf("cannot open out52.dat\n");
exit(0);
}
while (str[i])
{
ch = str[i];
___2___;
putchar(ch);
i++;
}
___3___;
}
“out52.dat”,”w” fputc(ch,fp) fclose(fp)
编辑特别推荐: