异常2error C2664: “sendto”: 不能将参数 2 从“CString”转换为“const char *”
2014-04-02 19:39
423 查看
错误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
错误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
相关文章推荐
- error C2664: “atoi”: 不能将参数 1 从“CString”转换为“const char *"
- Cstring转int型问题(error C2664: “atoi”: 不能将参数 1 从“CString”转换为“const char *”))
- Cstring转int型问题(error C2664: “atoi”: 不能将参数 1 从“CString”转换为“const char *”))
- “atof”: 不能将参数 1 从“CString”转换为“const char *”
- Cstring转int型问题(error C2664: “atoi”: 不能将参数 1 从“CString”转换为“const char *”))
- error C2664: "sendto": 不能将参数 2 从"CString"转换为"const char *"
- error C2664:不能将参数 1 从“CString”转换为“const char *”
- 关于CString剖析,“strcmp”: 不能将参数1从“CString”转换为“const char *”问题 from http://blog.csdn.net/cobay/article/details/3556307
- 【DEBUG】不能将参数 1 从“CString”转换为“const char *”
- 关于CString剖析,"strcmp": 不能将参数1从"CString”"转换为"const char *"问题
- C++: VC6转VC8出现问题:error C2664: “fopen”: 不能将参数 1 从“CString”转换为“const char *” from http://www.cnblogs.com/moon2bird/archive/2009/02/27/1399675.html
- 关于CString剖析,“strcmp”: 不能将参数1从“CString”转换为“const char *”问题
- 【DEBUG】不能将参数 1 从“CString”转换为“const char *”
- inet_addr”: 不能将参数 1 从“CString”转换为“const char *”1>
- 关于CString剖析,“strcmp”: 不能将参数1从“CString”转换为“const char *”问题
- VC2008: error C2664: ....不能将参数 1 从“CString”转换为“const char *”
- error C2664: “strcpy”: 不能将参数 2 从“CString”转换为“const char *”
- Cstring转int型问题(error C2664: “atoi”: 不能将参数 1 从“CString”转换为“const char *”))
- C++: VC6转VC8出现问题:error C2664: “fopen”: 不能将参数 1 从“CString”转换为“const char *”
- pcap_open_offline”: 不能将参数 1 从“CString”转换为“const char*