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:
but that doesnt work..Code:string ipaddress;
struct hostent *h;
h = gethostbyname(hostname.c_str());
ipaddress=h->h_addr;
Thanks!
Printable View
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:
but that doesnt work..Code:string ipaddress;
struct hostent *h;
h = gethostbyname(hostname.c_str());
ipaddress=h->h_addr;
Thanks!
lookup inet_ntoa or inet_ntop