Bitmap header 2 bytes too big!
Hi,
I was trying to create my own structures and typedefs for the bitmap file and info headers. I have written a 'console' program to display all of the specs for a selected bitmap (.bmp) file. However, the size of the file header for my program ends up at 16 bytes. When I comment out my header file and place #include <windows.h> everything is okay. I am trying to do this without reference to windows.h for my learning experience.
So...why is this file header structure missing two bytes? By the way, I am getting this 16 bytes by doing this command....
sizeof header;
Code:
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned long DWORD;
typedef struct _BITMAPFILEHEADER
{
WORD bfType; //2 bytes
DWORD bfSize; //4 bytes
WORD bfReserved1; //2 bytes
WORD bfReserved2; //2 bytes
DWORD bfOffBits; //4 bytes
} BITMAPFILEHEADER;
I get 14 bytes. Any explanation or thoughts would be appreciated.
Regards,
ChuckB