#define FILENAME
int main(void)
{
FILE * fp;
long len,i;
char *buf;
fp=fopen(FILENAME,"rt+");
if(fp==NULL)
{
printf("The file is not exeict!\n");
return -1;
}
fseek(fp,0L,SEEK_END);
len=ftell(fp);
buf=(char*)malloc(len);
if(*buf==NULL)
{
printf("Ram is out!\n");
return -1;
}
fseek(fp,0L,SEEK_SET);
fread(buf,len,1L,fp);
fclose(fp);
return len;
}
温馨提示:内容为网友见解,仅供参考