C语言中结构体小技巧
1.在结构体中指定成员的大小:
typedef struct ST_TIME{ DWORD second :6;// 秒 1-60 DWORD minute :6;// 分 1-60 DWORD hour :5;// 时 1-24 DWORD day :5;// 日 1-31 DWORD month :4;// 月 1-12 DWORD year :6;// 年 2000-2063 }TIME;
typedef struct ST_INFO{ DWORD32 cnt; BYTE time[1024] ; ST_INFO() { cnt = 0 ; memset((char*)(&time[0]) , 0 , 1024 ) ; }}INFO;