Hi all,
I have some serious trouble parsing information from
a graphics file in windows bmp format (256 colors).
I have managed to open the file but when i try to read
any of the data I always get 0.
If I open the file in binary format in visaual c++ I
can see that the file is correct and it starts with the
signature BM.
As I understand it, the (256 color) bmp consists of the 3 headers structs
BITMAPFILEHEADER, BITMAPINFOHEADER, RGBQUAD and then the actual picture data.
I suspect this is were something goes wrong:
...
ifstream fIn;
BITMAPFILEHEADER fileHeader;
...
fIn.read((char*) &fileHeader, sizeof(BITMAPFILEHEADER));
However my struct fileHeader is terrible empty...eventhough the above
statement should copy sizeof(BITMAPFILEHEADER) bytes to the struct fileHeader...right???
As I am a bit new to c++ I wonder how the reading should be done
since the way I do it seems to be wrong.
Hoping for a bit of help here...
Best Regards,
Christer