How to the no of attached ethernet adapters
I am writing a network application for the Red Hat system that requires to know the number of the network cards eth (ethernet adapters) attached to the system where the application is installed.
The way that I am using now to determine the number of NIC cards is by counting the number of the files that their names taking the form ifcfg-eth, where ifcfg-eth0, ifcfg-eth1 and so on are the configuration files for each adapter.
Is there another way by using C language that helps me to determine the number of adapters attached to my Red Hat system??