title: C procedure entry point inet_ntop WS2_32.dll on XP?
body: <p>I am getting an error on windows xp "The procedure entry point inet_ntop could not be located in the dynamic link library WS2_32.dll" and after some Googling I found that inet_ntop is not available in XP, so I made a Macro to use inet_ntoa instead. But it doesn't seem to be working, I still get the same error... Am I missing something?</p>
  
  <pre><code>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 &gt;= 0x600)
      if (inet_ntop(AF_INET, (void *)hent-&gt;h_addr_list[0], ip, iplen) == NULL)
      {
          perror("Could not resolve the host");
          exit(1);
      }
  #else
      ip = inet_ntoa(*((struct in_addr *)hent-&gt;h_addr_list[0]));
      if (ip == NULL)
      {
          perror("Could not resolve the host");
          exit(1);
      }
  #endif
  
      return ip;
  }
  </code></pre>