参考代码.h
上传用户:may_xy
上传日期:2007-08-09
资源大小:1519k
文件大小:1k
- //const int Spade = 0; //黑桃;
- //const int Hearts = 1; //红桃;
- //const int Club = 2; //梅花;
- //const int Diamonds = 3; //方块;
- pClient,pServer分别为派生自CSocket类指针;
- 有结构:
- CInfo
- {
- public:
- int m_Num;
- CString m_Name;
- };
- 进程1:(发送方)
- CInfo info;
- info.m_Num = 1;
- info.m_Name = "lin";
- pClient->Send(&info,sizeof(CInfo),0);
- 进程2:(接收方)
- CInfo _info
- pServer->Receive(&_info,sizeof(CPlayer_Info),0);
- 发送,接收都没有问题,但在接收方出现一个问题:
- _info.m_Num = 1; //这个数据正确;
- _info.m_Name = ""; //为空,而不是"lin",为什么?
- 请高手指教,跪求!