表示n字节对齐,比如n=1
typedef struct
{
short Type; //2字节
size_t Size; //4字节
short Reserved1; //2字节
short Reserved2; //2字节
size_t OffBits; //4字节
} BMP_FILE_HEADER;
结果: sizeof(BMP_FILE_HEADER)=16
#pragma pack(1)
typedef struct
{
short Type;
size_t Size;
short Reserved1;
short Reserved2;
size_t OffBits;
} BMP_FILE_HEADER;
pragma pack();
结果: sizeof(BMP_FILE_HEADER)=14
阅读(827) | 评论(0) | 转发(0) |