Getting the correct filesize?

  • Thread starter Thread starter Ady
  • Start date Start date
A

Ady

Hi,

I am doing the following to read in a file however it does'nt seem to be
reading in the correct size its like a few hundred bytes short?

level = fopen("c:\\MALEV01.AIM","r");
fseek(level,0,SEEK_END);
level_size=ftell(level);
fseek(level,0,SEEK_SET);
levelBuffer = (char*)malloc(level_size);
fread((char*)levelBuffer,1,level_size,level);

What am i doing wrong

Thanks

Ady.
 
Ady said:
I am doing the following to read in a file however it does'nt seem to be
reading in the correct size its like a few hundred bytes short?

level = fopen("c:\\MALEV01.AIM","r");

Try opening the file in binary mode: "rb"

Regards,
Will
 
Back
Top