#include #include #include #include struct BitmapFileHeader { char signature[2] = {0, 0}; uint32_t fileSize = 0; uint16_t reserved1 = 0; uint16_t reserved2 = 0; uint32_t imageDataOffset = 0; }; const std::string FILENAME = "elef.bmp"; int main() { BitmapFileHeader bitmapFileHeader; { std::ifstream ifs(FILENAME, std::ios_base::binary); ifs.seekg(0, std::ios::beg); ifs.read((char *) &bitmapFileHeader, 14); } std::cout << "Structure:\n" << "Signature: " << std::string(bitmapFileHeader.signature, 2) << "\nFile size: " << bitmapFileHeader.fileSize << "\nReserved 1: " << bitmapFileHeader.reserved1 << "\nReserved 2: " << bitmapFileHeader.reserved2 << "\nImage data offset: " << bitmapFileHeader.imageDataOffset << std::endl; return 0; }