一个很纠结的结构问题
定义了一个结构体
typedef struct tagRequestPersonListPack { BYTE cmd; // 0x21 unsigned short usID; // 设备ID unsigned short usReserve; // 保留字段 } REQUESTPERSONLISTPACK, *PREQUESTPERSONLISTPACK; CString str;str.Format("%dusid:%d-usReserver:%d",PREQUESTPERSONLISTPACK->cmd,REQUESTPERSONLISTPACK->usID,REQUESTPERSONLISTPACK->usReserve); ::AfxMessageBox(str,MB_OK);str.Format("%dusid:%d-usReserver:%d",p->cmd,p->usID,p->usReserve); ::AfxMessageBox(str,MB_OK);
[解决办法]
PREQUESTPERSONLISTPACK 是类型非变量
[解决办法]
1楼正确。
REQUESTPERSONLISTPACK是类型名,不是变量名