To find out what the current address is you could use "/sbin/ifconfig eth0" & write something to filter out the IP number. This will "get" the address for you but what do you mean by :
Quote:
set the default route or gateway address on a specific piece of hardware.
|
What do you want to "set"? What do you mean by setting it on a specific piece of hardware?
If you can use bash instead of C you can use the following line to get the current IP of eth0 :
Code:
/sbin/ifconfig eth0 | /bin/awk /eth0/'{next}//{split($0,a,":");split(a[2],a," ");print a[1];exit}'
It does exactly what I mentioned above in that it filters the IP out from the command "/sbin/ifconfig eth0"