fstream: changing only certain values

I have been making a program that will help me a bit with my game development diploma. I have been writing a small console program where you can edit the stats that are input and change a few different things. I have created one "prototype" of this program, that took me days :) . It works but it is extremely inefficient and over 1000 lines long for something so simple as it was my first project, using pdf's for reference.

Now in the prototyped program, I needed to save the variables to a text of sorts, and ended up having to have a class with 24 different stats, plus about 10 functions, which seemed like overkill. So now that I have learned alot from building it, I am going to rebuild it, but don't know how I would save the values.

I have tried opening the file and getting the value, which was a pain in the ass because if health in the text file is set at 1000, and the new value to set is 999, you get left with 9990, the trailing 0 from the existing value stays there.

Surely C++ has an easier way to do this operation. Surely I dont have to have a class with 30 different variables just to save them.


Sorry for the wall of text :D
This is the wrong way to ask for help. A wall of text containing nothing that can help us help you. And naturally, with no source code posted.

So you have a small bug when reading data from text files?
Post the code where the reading happens and also a sample text file, so we can see what may be going wrong, and then explain to you why.
Topic archived. No new replies allowed.