How to get domain ip address using domain name in C++?
<p>i am using visual c++,</p>

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

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

<p>But i get a wrong ip address.</p>
