I want to find out the default network in use. My current method was to find all IP addresses and compare it to the default gateway IP address, but that sounds silly. What is the correct way of doing it ?
UPDATE
I want to use a C program, not by commands ...
You can try a slightly dirtier but infinitely easier approach:
So you can try:
Then you can use
strtok
,strstr
etc.