写了一片
if((fp = fopen(cfg_file, "r"))==NULL) //make sure to be opened file exist
{
printf("\n cannot find file\n");
exit(0);
}
else
{
}
printf("\n can find file\n");
fseek(fp,0L,SEEK_END); //calculate file size
flen=ftell(fp);
printf("shuzi :%d",flen);
itoa(flen,hex_len,10);
fread(fbuffer,4,1,fp);
printf("\nfile content:%s\n",fbuffer);
if((fp = fopen(cfg_file, "r"))==NULL) //make sure to be opened file exist
{
printf("\n cannot find file\n");
exit(0);
}
else
{
fread(fbuffer,4,1,fp);
printf("\nfile content:%s\n",fbuffer);
}
printf("\n can find file\n");
fseek(fp,0L,SEEK_END); //calculate file size
flen=ftell(fp);
printf("shuzi :%d",flen);
itoa(flen,hex_len,10);