I''m trying to get an IP address from an URL. This works fine when I use "www.dog.com" but when I want to use a variable it doesn''t work.HOSTENT *pHostEnt;int **ppaddr;SOCKADDR_IN sockAddr;char* addr;std::wstring site;site = wsURL.c_str();pHostEnt = gethostbyname("site");ppaddr = (int**)pHostEnt->h_addr_list;sockAddr.sin_addr.s_addr = **ppaddr;addr = inet_ntoa(sockAddr.sin_addr); 解决方案 这篇关于按名称获取主机(带有变量)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-13 01:04