数据包里的字符串
typedef struct hdr_pack_msg
{
char type;
CString filePath;
DWORD dwIP;
bool isWorking;
bool hasDown;
bool exit;
}HDR_PACK_MSG;
为什么我发送这个自定义的包,每次收到的filePath都为空,而其他的变量值是正确的呢。
就算我在发送方把filePath写死,也收不到这个值。
如 HDR_PACK_MSG hdr;
hdr.type = W;
hdr.dwIP = inet_addr(m_grid.GetItemText(i, 1));
hdr.filePath = "H:\Adobe CS4....";
hdr.isWorking = TRUE;
hdr.hasDown = FALSE;
hdr.exit = FALSE;
//将命令包发送给客户端
int err = send(sClient, (char*)&hdr, HDRLEN, 0);
接收端:
HDR_PACK_MSG hdr;
int nerrCode;
nerrCode = recv(sClient, (char*)&hdr, HDRLEN, 0);
除了filePath 为空,其他变量都正确。HDRLEN是包的大小