first of all congrats about this great forum it has been a real help for me since I started to learn C (that is 3 months ago ).
As you understand I am a complete newbie so I would like you to help me in a program that I am trying to develop. (shouldnt be too hard for you)
The thing is that I must develop a program which will take 2 (or 3) parameters
1) MaxKeepAliveRequests or Timeout
2) a value
3) -M (which is optional)
now this program must search for the word MaxKeepAliveRequests or Timeout in a file called httpd.conf (the apache server one), find the word and replace the value after the "=" sign.
-M will update the new value only if its higher than the value in the file.
for example: UPDCONF Timeout 32
should check the file httpd.conf which looks like this
MaxKeepAliveRequests = 2
Timeout = 5
find Timeout and make the value 32.
So far what I have done is change the value of ALL variables in a file using fscanf and fprintf.
Oh and the only way that I managed to read the file was to remove the = sign and have only one space instead of it which is wrong.
This is what I've made so far including a sample httpd.conf file
RapidShare: 1-CLICK Web hosting - Easy Filehosting
I hope you didnt get dizzy from my post
(just to inform you)
I copy the file httpd.conf in "r" mode then I copy itself to httpd.temp and I read it in "w" mode then I rename .conf -> .bak and .temp -> .conf