>> On Wed, 19 May 2004 22:04:42 -0400
>> > On RedHat 9, programming in C++, on a machine that
>> > has several ethernet cards, I need to determine the
>> > device (eth0, eth1, etc.) from the ip address
>> > (192.168.1.10, etc.). Is there a function that
>> > will do this?
>> read /etc/network/interfaces? (if the IP addresses are static)
>[...]
>I do not have this file on my RH9. My ip addresses are static.
He probably meant /proc/net/dev, but that is not really
satisfactory because while it does list interfaces, it does not
list the ip addresses.
There have been many articles posted to Usenet showing the correct
use of SIOGCIFCONF using C, which should suffice as an example of
where to start with C++. (I've posted several myself.)
Go to http://groups.google.com/advanced_group_search and do a
search the word SIOGCIFCONF restricted to comp.os.linux.* only,
and you'll come up with several articles.
--
Floyd L. Davidson <http://web.newsguy.com/floyd_davidson>