Am 19.12.2009 16:35, schrieb Gene Creighton:
typedef struct { short ImageFileType; long FileSize; short Reserved1; short Reserved2; long ImageDataOffset; } WIN3XHEAD; typedef struct { long HeaderSize; long ImageWidth; long ImageHeight; short NumberOfImagePlanes; short BitsPerPixel; long CompressionMethod; long SizeOfBitmap; long HorzResolution; long VertResolution; long NumColorsUsed; long NumSignificantColors; } WIN3XINFOHEAD; ----------
Try appending __attribute__((packed)) after the closing } of the structs in question. That should disable padding.
Furthermore I recommend using int32_t instead of long, since long is 8 bytes on 64-bit Linux systems (hence your code wouldn't work on those).
Best regards.