要设置一个结构体的对齐问题,使用如下方式:
#pragma pack(1) //设置开始使用字节对齐
typedef struct
{
char chRIFF[4];
unsigned int total_Len;
char chWAVE[4];
char chFMT[4];
unsigned int dwFMTLen;
unsigned short fmt_pcm;
unsigned short channels;
unsigned int fmt_samplehz;
unsigned int fmt_bytepsec;
short fmt_bytesample;
unsigned short fmt_bitpsample;
char chDATA[4];
unsigned int dwDATALen;
}WaveHeader;
#pragma pack() //设置结束使用字节对齐