how we can get gateway address

how we can get the gateway address.
i know gethostname used for ipaddress
how we can get the system gateway address.
thank u inadvance,
sree

To start with, you cant get it by duplicating/bumping up posts.

The gateway address is different for different organizations. I dont think there is any standard API (atleast I am not aware of one) to retrieve the gateway address. But in saying so, I can see someone has written a code to retrieve the gateway address. See http://www.linuxquestions.org/questions/showthread.php?t=397078.

That code is interesting, but I had never heard of PF_NETLINK before. It is not on HP-UX and my guess is that it is only on Linux. Cool concept though...