C语言中清除文件中保存的内容要怎么写呢?求帮忙

如题所述

c++
#include <iostream>
using namespace std;

int main()
{
FILE *fp;
if((fp=fopen("11.txt","w+"))==NULL)
exit(9);
fprintf(fp,"");
fclose(fp);
return 0;
}

C
#include <stdio.h>
int main()
{
FILE *fp;
if((fp=fopen("11.txt","w+"))==NULL)
printf("打开失败\n");
fprintf(fp,"");
fclose(fp);
return 0;
}

追问

谢谢哦

懂了

温馨提示:答案为网友推荐,仅供参考
相似回答