lab1
March 13th, 2009, 02:41 PM
Hello,
I have a hostent h_addr and I want to convert that to a string IP address. How can I do that?
I tried this:
string ipaddress;
struct hostent *h;
h = gethostbyname(hostname.c_str());
ipaddress=h->h_addr;
but that doesnt work..
Thanks!
I have a hostent h_addr and I want to convert that to a string IP address. How can I do that?
I tried this:
string ipaddress;
struct hostent *h;
h = gethostbyname(hostname.c_str());
ipaddress=h->h_addr;
but that doesnt work..
Thanks!