1.
#pragma pack(push,1) typedef struct tagBITMAPFILEHEADER { uint16_t bfType; uint32_t bfSize; uint32_t bfReserved; uint32_t bfOffBits; } BITMAPFILEHEADER; typedef struct tagBITMAPINFOHEADER { uint32_t biSize; int32_t biWidth; int32_t biHeight; uint16_t biPlanes; uint16_t biBitCount; uint32_t biCompression; uint32_t biSizeImage; int32_t biXPelsPerMeter; int32_t biYPelsPerMeter; uint32_t biClrUsed; uint32_t biClrImportant; } BITMAPINFOHEADER; #pragma pack(pop)
According to the above code written documents, picture files open failed, said file is damaged.
Later found inside the variable ordering BMPFILEHEADER_T this data interface, not 4-byte aligned, leading to sizeof (BMPFILEHEADER_T) larger than expected!
Therefore, the data structure is provided directly by the macro-byte alignment is: 1 byte alignment.