有以下程序: #include main() { FILE*f; f=fopen("filea.txt","W"); fprintf(f,"abe"); fclose(f); } 若文本文件filea.txt中

admin2020-01-10  23

问题 有以下程序:
  #include
  main()
  {  FILE*f;
    f=fopen("filea.txt","W");
    fprintf(f,"abe");
    fclose(f);
  }
  若文本文件filea.txt中原有内容为:hello,则运行以上程序后,文件filea.txt中的内容为(    )。

选项 A、helloabe
B、abelo
C、abe
D、abchello

答案C

解析 fopen("filea.txt","w’);表示以只写模式打开filea.txt,fprintf(f,"abc");是先将文件清空再写入。所以filea.txt中内容为abe。
转载请注明原文地址:https://kaotiyun.com/show/TFCp777K
0

随机试题
最新回复(0)