Greetings,
I wrote the following code and wish I could get IP address
like 64.58.76.176.
But it give me like this" J5J3@:L藏 J4@:L矦:L柏 J
J7@:L".
What's wrong? Thanks.
I use "g++ -o try -lsocket -lnsl try.cpp " to compile it.
struct hostent *h;
char addr[] = "www.yahoo.com";
h = gethostbyname(addr);
cout << h->h_addr << endl;