How to get domain ip address using domain name in C++?
===

i am using visual c++,


I want to get a domain ip address from domain name..
how do i get it..
i already tried gethostbyname function...
here my code...




        HOSTENT* remoteHost;        
        IN_ADDR addr;       
        hostName = "domainname.com"; 
        printf("Calling gethostbyname with %s\n", hostName);
	remoteHost =gethostbyname(hostName);
	memcpy(&addr.S_un.S_addr, remoteHost->h_addr, remoteHost->h_length);
	printf("The IP address is: %s\n", inet_ntoa(addr));


But i get a wrong ip address.