请教 CMap 的有关问题
请问 CMap 的问题?
为什么 我的程序中,POSITION 不起作用,map里面有值的、
------解决方案--------------------
这不科学啊,你的map是什么变量,成员、全局?
------解决方案--------------------
POSITION转化为BOOL类型会怎么样?
------解决方案--------------------
应该没问题啊,最后POSITION对象值为NULL,循环结束
POSITION pos = this->map.GetStartPosition();
CString cAppid;
toClientMsg tmpMsg;
serverSaveClient clientInfo;
char *sendMsg = new char[sizeof(toClientMsg)];
memcpy(tmpMsg.sMsg,"CLOSE",sizeof(toClientMsg));
while(pos)
{
MessageBox(_T("1"));
map.GetNextAssoc(pos,cAppid,clientInfo);
if(send( clientInfo.iSocket, tmpMsg.sMsg, sizeof(toClientMsg), 0 ) == -1 )
{
MessageBox(_T("Send message fail."));
}
}
delete sendMsg;
为什么 我的程序中,POSITION 不起作用,map里面有值的、
------解决方案--------------------
这不科学啊,你的map是什么变量,成员、全局?
------解决方案--------------------
POSITION转化为BOOL类型会怎么样?
------解决方案--------------------
应该没问题啊,最后POSITION对象值为NULL,循环结束