项目为Unicode字字符集,调用inet_addr错误信息inet_addr cannot convert parameter1 from CString to const char*
代码修改如下通过:
CString serverip; serverip = "192.168.0.9"; char cip[30] wcstombs(cip, serverip, serverip.GetLength() * 2); unsigned long ip = ntohl(inet_addr(cip));
参考: