//2018/4/21 文件的使用
#include<stdio.h>
#include<stdlib.h>//exit
#include<string.h>
#include<ctype.h>
#define N 100
//以下函数是什么意思?
/*
fclose();
feof();
fgetc()'
fgets();
fopen();
fputc();
fputs();
fread();//2针对2进制文件
fseek();
fwrire();//2
getc();
getchar();
getw();
putchar();
puts();
putw();
getchar();
*/
int main()
{
char ar[N];
FILE *fp = fopen("wmll.txt","r");
if(fp==NULL)
{
printf("open error!\n");
exit(1);
}
for(int i=0;i<10;i++)
{
fscanf(fp,"%d ",&ar[i]);//这个函数基本没有使用的意义
}
fclose(fp);
fp = NULL;
return 0;
}
/*int main()
{
char ar[N]={"lihenghui love wml!"};
FILE *fp = fopen("wmll.txt","w");
if(fp==NULL)
{
printf("open error!\n");
exit(1);
}
for(int i=0;i<N;i++)
{
fprintf(fp,"%d ",ar[i]);////这个函数基本没有使用的意义
}
fclose(fp);
fp = NULL;
return 0;
}
*/
c语言文件函数的使用
猜你喜欢
转载自blog.csdn.net/Wmll1234567/article/details/80529366
今日推荐
周排行