I'm trying to read in a bitmap starting with its header, but fread is skipping characters for me.
I'm using this typedef in my header:
#include <windows.h> // Used for other
#include <cstdio>
typedef struct tagBITMAPHEADER{
WORD wFileType;
DWORD dwFileSize;
WORD dwReserved;
WORD dwReserved2;
DWORD dwBmpDataOffset;
DWORD dwBmpHeaderSize;
DWORD dwWidth;
DWORD dwHeight;
WORD wPlanes;
WORD wBitsPerPixel;
DWORD dwCompression;
DWORD dwBitmapDataSz;
DWORD dwHRes;
DWORD dwVRes;
DWORD dwColors;
DWORD dwImpColors;
} BITMAPHEADER, *PBITMAPHEADER;
And in my code, I just use a simple fopen and fread with binary.
#include "ImageLoader.h"
BITMAPHEADER pbhFileInfo;
FILE *fBitmap = fopen(FileName,"rb"); //Open file in read / binary
if (fBitmap) //File is now open
{ fread(&pbhFileInfo,sizeof(BITMAPFILEHEADER),1,fBitmap);
fclose(fBitmap);
}
Although my bitmap starts with '424DF25A0D' (hex), the first two variables read in seem to skip the 'F25A'
wFileType = 0x4d42 dwFileSize = 0x0000000d
Any idea what might be up?
Thanks in advance.