Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, I want to read network configuration paramters like IP, Gateway and DNS from my C code. Should I read the config file /etc/resolv.conf or Is there any "structure" which ...
  1. #1
    Just Joined!
    Join Date
    Feb 2008
    Posts
    50

    Reading network Config Paramters

    Hi,

    I want to read network configuration paramters like IP, Gateway and DNS from my C code.

    Should I read the config file /etc/resolv.conf or Is there any "structure" which gives the current network configuration parameter values.

    Please suggest.

  2. #2
    Just Joined! KPolulak's Avatar
    Join Date
    Feb 2009
    Location
    New Jersey, USA
    Posts
    42
    I would recommend just using `ifconfig` and using `grep`or a simple Perl script to process the output. You could also use the "regex.h" header file but I've never used it myself.

    If you'd like, I'd be willing to write a Perl script for you that does this.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...