#include <stdio.h>
#include <string.h>
int main()
{
FILE *fp = NULL;
int nRet = 0;
char readBuff[12];
memset(readBuff,0,12);
fp = fopen("mm","r");
if(fp == NULL){
printf("open failed !\n");
return -1;
}
printf("open success \n" );
nRet = fread(readBuff,4,2,fp);
if(nRet <= 0){
printf("fread failed \n");
return -3;
}
printf("read success %s \n",readBuff);
nRet = fclose(fp);
if(nRet){
printf("close failed \n");
return -2;
}
}
linux的fread函数的使用
最新推荐文章于 2025-03-19 22:26:49 发布