#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;
}
本文出自 “计算机” 博客,请务必保留此出处http://5152481.blog.51cto.com/5142481/1574078
原文地址:http://5152481.blog.51cto.com/5142481/1574078