题目内容

有如下程序#include "stdio.h"int main(void){FILE *fp1;fp1=fopen("f1.txt","w");fprintf(fp1,"abc");fclose(fp1);return 0;}若文本文件f1.txt中原有内容为:good,则运行以上程序后文件f1.txt中的内容为

A. goodabc
B. abcd
C. abc
D. abcgood

查看答案
更多问题

有以下程序#include "stdio.h"void WriteStr(char *fn,char *str){ FILE *fp;fp=fopen(fn,"w");fputs(str,fp);fclose(fp);}int main(void){WriteStr("t1.dat","start");WriteStr("t1.dat","end");return 0;}程序运行后,文件t1.dat中的内容是_____。

A. start
B. end
C. startend
D. endrt

有以下程序#include "stdio.h"int main(void){ FILE *fp; int i, k, n;fp=fopen("data.dat", "w+");for(i=1; i<6; i++){ fprintf(fp,"%d ",i);if(i%3==0) fprintf(fp,"\n");}rewind(fp);fscanf(fp, "%d%d", &k, &n);printf("%d %d\n", k, n);fclose(fp);return 0;}程序运行后的输出结果是

A. 0 0
B. 123 45
C. 1 4
D. 1 2

有以下程序#include "stdio.h"int main(void){ FILE *fp; int i,k=0,n=0;fp=fopen("d1.dat","w");for(i=1;i<4;i++) fprintf(fp,”%d”,i);fclose(fp);fp=fopen("d1.dat","r");fscanf(fp,"%d%d",&k,&n);printf("%d %d\n",k,n);fclose(fp);return 0;}执行后输出结果是

A. 1 2
B. 123 0
C. 1 23
D. 0 0

若调用fputc函数输出字符成功,则其返回值是

A. EOF
B. 14
C. 0
D. 输出的字符

答案查题题库