IP ADDRESS OF MACHINE

snodx@hotmail.com snodx@hotmail.com
Tue Feb 26 00:35:00 GMT 2002


Gretings,
         I was exploring the header files that come alongwith the GNU Gcc package when I came across the function gethostname in unistd.h

         When I called the function I got the hostname of the machine on which I was running the program.

         Is there a similar function which can return the IP Address of the machine? I tried gethostid but it is returning a number in long int format.

         I may mention that I have RedHat Linux 6.0 with gcc version 2.91 installed. I dont know if I have a network card installed but I set the IP Address using the /bin/netconf utility.

         SNODX



More information about the Gcc-help mailing list