#ifndef __WIN32__ # include # include # include # include #else # include # include #endif #include #include "main.h" char* getIPFormDNS(char *domain) { struct hostent *host; host = gethostbyname(domain); if( host == NULL || host->h_addr_list[0] == NULL ) { return NULL; } return strdup( inet_ntoa( * ( (struct in_addr *) host->h_addr_list[0] ) ) ); }