long int filenamesize = strlen(filename);
FILE* filetemp = fopen(filename,"rb");
long int filesize = GetFileSize(filetemp);
long int resourcesize = GetFileSize(resourcefile);
char* buffer = (char*)malloc(filesize);
fread(buffer,1,filesize,filetemp);
Now for some reason, I get a blank buffer when I'm doing this. Anyone have any idea why? I'm trying to open a totally red (255,0,0) 196x196 bitmap, but the buffer's empty. Any idea why?
EDIT: And the file is open, it gets the file size properly as something around 115000 bytes or something
Binary File IO in C
My first instinct is that GetFileSize() is returning 0 or a negative value, so you're not actually reading anything in. Otherwise, it should work.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement