Я получаю сообщение об ошибке в Windows XP: «Точка входа процедуры inet_ntop не может быть расположена в динамической библиотеке ссылок WS2_32.dll», и после некоторого Googling я обнаружил, что inet_ntop недоступен в XP, поэтому я сделал макрос для использования inet_ntoa. Но, похоже, он не работает, я все равно получаю ту же ошибку ... Я что-то упустил?C точка входа процедуры inet_ntop WS2_32.dll на XP?
char *get_ip(char *host)
{
struct hostent *hent;
int iplen = 39;
long errorcode;
char *ip = (char *)malloc(iplen + 1);
memset(ip, 0, iplen + 1);
if ((hent = gethostbyname(host)) == NULL)
{
perror("Could not get the IP address");
exit(1);
}
#if (_WIN32_WINNT >= 0x600)
if (inet_ntop(AF_INET, (void *)hent->h_addr_list[0], ip, iplen) == NULL)
{
perror("Could not resolve the host");
exit(1);
}
#else
ip = inet_ntoa(*((struct in_addr *)hent->h_addr_list[0]));
if (ip == NULL)
{
perror("Could not resolve the host");
exit(1);
}
#endif
return ip;
}