Hi,
I want to get the hostname and the ip address of the machine in C on both windows and linux environments. Are there any functions in C which will give me this information?
Thanks,
Chandana.
Printable View
Hi,
I want to get the hostname and the ip address of the machine in C on both windows and linux environments. Are there any functions in C which will give me this information?
Thanks,
Chandana.
gethostname(), gethostbyaddr(), gethostbyname().
Thanks for the reply.
Can you give me some sample code which uses this gethostname(). I am trying to call gethostname() from the main function, but I am getting "segmentation fault" error.
Post your code that is giving you the seg fault.