Writing structure in a unsigned char array
I want to write the 2 structures of the bmp file into a buffer of unsigned char.Infact i am trying to write the whole bitmap into a buffer of usigned char, including headers and data. Can any one tell me how it is possible?
I am trying to write the following structues in the memory allocated as "unsigned char Bitmap[IHeader.BiSizeImage];
////////////////////////Structure for the BMP file header/////////
struct BmpFileHeader
{
unsigned short BfType;
unsigned long BfSize;
unsigned short BfReserved1;
unsigned short BfReserved2;
unsigned long BfOffBits;
};
///////////////////////Structure for the BMP Image Header/////////
struct BmpImageHeader
{
unsigned long BiSize;
unsigned long BiWidth;
unsigned long BiHieght;
unsigned short BiPlanes;
unsigned short BiBitCount;
unsigned long BiCompression;
unsigned long BiSizeImage;
unsigned long BiXPixPerMeter;
unsigned long BiYPixPerMeter;
unsigned long BiColorUsed;
unsigned long BiColorImportant;
};