Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get the subnet mask using C?

Status
Not open for further replies.

vkarthik

Programmer
Aug 30, 2001
126
US
I need to retrieve the subnet mask of the default network interface of a PC, using C language. The OS is linux.

Does anybody know some C function that does this? I know that there are some files storing the interface details, and they can be read and parsed. But is there a simpler way out?

This may not be the right forum, but I'm posting it here since most of the linux commands can be used as C library functions.


LOL A ship is safe in the harbour, but that's not what it is meant for!!! LOL
 
I would think that a quick look at the 'ifconfig' or 'route' source code would solve your problem easily.

They are, after all, open source.


pansophic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top