-->
当前位置:首页 > 题库 > 正文内容

填空题:文件读写

Luz3年前 (2022-11-02)题库409

#include <stdio.h>
#include <stdlib.h>

int main()
{
char x[10],c='x',y;
FILE *fp;
fp=fopen("file.txt","w");
if(fp==NULL)
{
printf("error");
exit(0);
}
fprintf(fp,"%s","abc");
fclose(fp);
fp=fopen("file.txt","w+");
if(fp==NULL)
{
printf("error");
exit(0);
}
fputc(c,fp);
rewind(fp);
fgets(x,10,fp);
printf("%s",x);
fclose(fp);
return 0;
}

程序输出结果是





答案:
第1空:x ||

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。