#include
#include
int main()
{
char hostn[400]; //placeholder for the hostname
struct hostent *hostIP; //placeholder for the IP address
//if the gethostname returns a name then the program will get the ip
address using gethostbyname
if((gethostname(hostn, sizeof(hostn))) == 0)
{
hostIP = gethostbyname(hostn); //the netdb.h function gethostbyname
printf("IP address: %s\n", inet_ntoa(*(struct in_addr
*)hostIP->h_addr));
}
else
{
printf("ERROR:FC4539 - IP Address not found."); //error if the
hostname is not found
}
return 0;
}
2007-04-23 15:44:19
·
answer #1
·
answered by Shaifu 3
·
0⤊
0⤋
Ha! Dang I lost now; System > Administration > Network Tools
Dang, if I know what happening, everyone drinking beer and jammin' here! Sorry.
2007-04-23 15:51:30
·
answer #2
·
answered by Snaglefritz 7
·
0⤊
0⤋
Try Panky's method...or if you're short on time just enter "ifconfig" at the console.
2007-04-23 15:48:57
·
answer #3
·
answered by Anonymous
·
0⤊
0⤋
ifconfig
2007-04-23 15:51:30
·
answer #4
·
answered by john h 1
·
0⤊
0⤋
Type in.. www.whatismyip.com
thats yours
2007-04-25 05:04:46
·
answer #5
·
answered by ★★★ Katharine ♥♥♥♥ 6
·
0⤊
0⤋