I'm trying to retrieve the ip address of the local machine in my program. The OS running is Ubuntu 8.10. I tried using gethostname() and gethostbyname to do it. All I can get is 127.0.1.1. I learned that it seems to be a Debian thing:
This thread explained it.
The content of my /etc/hosts file is also:
127.0.0.1 localhost
127.0.1.1 mymachine
In this case, is there any other way to programactically (prefer C or C++) to get the ip address without modifying the system file on the machine? Thanks in advance.
g.c.