#include<stdio.h>
int main(int argc,const char*argv[])
{
//文件的保存
FIlE * fp1;
fp1=fopen("//users//huangqiaoping//Desktop//ok.txt","w");
fprintf(fp1,"兄弟连 我来了");
int hp=100;
fprintf(fp1,"\n是时候奋斗一下了%");
fclose(fp1);
//文件的读取
fp1=fopen("//users//huangqiaoping//Desktop//ok.txt","r");
char msg[20000];
int n=0;
while(1)
{
fscanf(fq1,"%c",&msg[n])
if(msg[n]==EOF)
{
break;
}
n++;
}
printf("读取的文件内容是:%s",msg);
fclose(fp1);
return 0;
}
时间: 2024-10-12 20:13:08