全部题库 / C语言 / 试题详情
填空题 C语言
2012-07-07

设文件test.txt中原已写入字符串Begin,执行以下程序后,文件中的内容为(  )。
#include 
mian()
{ file *fp;
 fp=fopen(“test.txt”,”w+”);
 fputs(“test”,fp);
 fclose(fp);
}

参考答案

暂无

答案解析

test

fopen函数功能是打开一个文件,函数原型FILE*fopen(constchar*path,constchar*mode);当mode为w+,若文件存在则文件长度清为零,即该文件内容会消失。若文件不存在则建立该文件.fputs将字符串写入到fp中.所以文件内容为test。