Hi all
Just wondering how I would update a config file in order to change some of its values. This is just a sample config to show you want I mean
// graphics
Screen_Width=1024
Screen_Height=768
BPP=32
If I wanted to change the BPP for example via a GUI, what would I need to do programming wise to change the value of the BPP field from 32 to say 64? I can design the GUI I would need but seem to be stumbling on how to make such a change via code.
Thanks and love this site!
updating a .cfg file
Page 1 of 12 Replies - 162 Views - Last Post: 02 January 2013 - 04:35 PM
Replies To: updating a .cfg file
#2
Re: updating a .cfg file
Posted 02 January 2013 - 04:32 PM
a .cfg is just a text file with .cfg as the extension.
Read in the entire file storing all the values.
Make the changes in memory.
Write the entire file back out.
Being a text file you can't just change one part of it. You have to write the entire file.
excerpt from my new coder resources post:
Writing a text file is always one of the first things people want to do, in order to store data like high-scores, preferences and so on.
Writing a text file tutorial.
Reading a text file tutorial.
.Split()ing a string
Have you seen the 500+ MSDN Code Samples? They spent a lot of time creating samples and demos. It seems a shame to not use them.
Read in the entire file storing all the values.
Make the changes in memory.
Write the entire file back out.
Being a text file you can't just change one part of it. You have to write the entire file.
excerpt from my new coder resources post:
Writing a text file is always one of the first things people want to do, in order to store data like high-scores, preferences and so on.
Writing a text file tutorial.
Reading a text file tutorial.
.Split()ing a string
Have you seen the 500+ MSDN Code Samples? They spent a lot of time creating samples and demos. It seems a shame to not use them.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|