The sizeof(bmp_head) is 10 bytes instead 14 it should be. This caused due structure alignment.
sizeof(bmp_head)
This helps me: #pragma pack(2) // Pack structures by 2 bytes
#pragma pack(2) // Pack structures by 2 bytes