#include <stdio.h>
/*******************
*name:fread.c
*author:QG
*time:2015-05-12
*description:read a item from a file.
********************/
int main()
{
FILE *fp;
char c_buf[11];
int a = 1;
fp = fopen("./123.txt","r");
fread(c_buf,1,10,fp);
c_buf[10] = '\0';
printf("read content:%s!\n",c_buf);
a = fclose(fp);
if(a == 0)
{
printf("close file is OK ,a = %d!\n",a);
}
else if(a == EOF)
{
printf("close fail!\n");
}
return 0;
}
库函数调用 3--fread
最新推荐文章于 2023-12-11 16:07:21 发布