错误2error C2664: “sendto”: 不能将参数 2 从“CString”转换为“const char *”VC 6的时候可能没问题,VC2005咋弄?
GetDlgItemText(IDC_EDIT2,strSend);
sendto(m_socket,strSend,strSend.GetLength()+1,0,(SOCKADDR*)&addrTo,sizeof(SOCKADDR));
------解决方案--------------------
sendto(m_socket,(LPCSTR)strSend,strSend.GetLength()+1,0,(SOCKADDR*)&addrTo,sizeof(SOCKADDR));
------解决方案--------------------
类型不同的,一个是cstring,一个是const char*,要进行类型转换
vc2005更标准了
------解决方案--------------------
unicode吧,直接发unicode,然后接收时也按照unicode来处理
sendto(m_socket,(LPCSTR)(LPCTSTR)strSend,strSend.GetLength()*2+2,0,(SOCKADDR*)&addrTo,sizeof(SOCKADDR));
------解决方案--------------------
改变工程设置中不使用UNICODE
Project->Property->Configuration Properties->General->Character set