I've done this about a billion times and yet this time its not working right.
This is insane. Here is the code.
This header is just the two headers in the SDK merged together.
The Type field is correct with 0x4D42 which means it's reading the first __int16 right. Then it proceeds to tell me that the Size is only 3 bytes??? Stupid. I opened this file in QuickBasic 7.1 and read the Size member and it was correct. The file is good but for some stupid reason my code doesn't work. Either I'm not using sprintf() right which is showing erroneous values or something else is wrong.
void LoadBMPColorMap(std::string File,VoxelRGB *Map,BMPHeader bmpinfo);
LoadBMPColorMap("blah blah blah",ColorMap,ColorMapInfo);
void LoadBMPColorMap(std::string File,VoxelRGB *Map,BMPHeader bmpinfo)
//Just to be sure
I even commented out all dynamic memory allocation prior to this function. The only thing happening is the loading of the bmpheader, but it doesn't work?
I've tried _read,_open, fread, fopen, etc. All have the same result. WTH is going on?
I feel stupid for asking this.
Structure alignment is 8 bytes, but I have changed it and the same thing happens. The file is 256x256 in 32 bit color. Something somewhere is fragging my structure alignment.
I even took out the code that loaded the image data into the VoxelRGB map. It made no difference and it didn't work because the width was being reported well into the billions. Trying to access memory using y*width+x when width is near 3 billion...well Windows doesn't like that. Clearly an alignment problem somewhere.
But if the first __int16 is correct, how can the member immediately following that one be off?? Weird.
Sorry I can't post the entire program here....it's enormous.