vbnullchar Posted September 7, 2006 Share Posted September 7, 2006 hi everyone, how can i read/write a config file heres my config file >> config.cfg <<[topic]title = "sample title"[sub-topic]sub_title = "sample sub title"[rate]rate1 = 1thanks Quote Link to comment Share on other sites More sharing options...
tomfmason Posted September 7, 2006 Share Posted September 7, 2006 You might want to look into [url=http://us2.php.net/manual/en/function.fread.php]fread[/url] and [url=http://us2.php.net/manual/en/function.fwrite.php]fwrite[/url]. Good Luck,Tom Quote Link to comment Share on other sites More sharing options...
vbnullchar Posted September 7, 2006 Author Share Posted September 7, 2006 hi tom, thanks for the reply. how about if i want to modify a certain value. Quote Link to comment Share on other sites More sharing options...
tomfmason Posted September 7, 2006 Share Posted September 7, 2006 this is some what complex and you may run into serveral issues. What I would do is have a table in a db with the fields that I want in my file. Then if I need to change a certain field, I would update the db then rewrite the file. It is easier to add a new line(with out a db.) then it is to edit a line. This is because if you are going to have multipule lines within your topic = " "; it will be very difficult to read inbetween the "" . Were as if you just rewrote the file from a db it would only take seconds and you would know that you got it right..Good Luck,Tom Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.