LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   DHCP Server (https://www.linuxquestions.org/questions/linux-networking-3/dhcp-server-899736/)

kumawat10 08-26-2011 11:07 PM

DHCP Server
 
Hey all.. I want to change my dhcpd.conf file dynamically using C program.. The values of the parameters in the dhcpd.conf file will be provided by an application which will take inputs from the admin and accordingly, pass the values which I need to change in my dhcpd.conf file.. Please suggest some way to do it..

I thought of rewriting the .conf file each time when the values are given by the admin but will it be feasible??

Please anyone reply asap..

Thanks in advance...

kumawat10 08-27-2011 04:03 AM

Some one pls reply.. :cry:

scheidel21 08-27-2011 08:35 PM

Look at file IO with text files.

kumawat10 08-29-2011 12:39 AM

may u pls elaborate??

scheidel21 08-29-2011 07:28 PM

Here's a good place to start http://www.cprogramming.com/tutorial/cfileio.html another http://www.learn-programming.za.net/...c_learn10.html yet another http://cplus.about.com/od/learningc/ss/text-files.htm some more http://www.mycplus.com/tutorials/c-p...file-handling/ and yet even more http://www.google.com/search?sourcei...ith+text+files

scheidel21 08-29-2011 07:30 PM

As a tip to doing this, you have a couple of options, one is to do as you suggest re-writing the conf file each time. Alternatively if you know the keywords in the file that need to be edited for each admin entry then you could read the file and search for the keyword(s) then re-write just that line.


All times are GMT -5. The time now is 12:54 PM.