<gu******@gmail.com> wrote:
Howdy, I am just learning c++ and of course i am doing the classic
"gradeBook" program, but i am trying to figure out a way to save my
data so that the next time my prog is opened it will still be there.
Someone told me to look at the 'data stream' but i do not know what
that is. Please help (specifics/explanations are always appreciated)
What you are trying to do is produce "persistence", aka "serialization".
Those words as a target on google should help.
Assuming you have a grade book class, you want to create a save member
function and a restore member function for that class. If you are clever
enough they could be called by the destructor and the constructor. The
cleverness involves figuring out whether this is the first run in the life
cycle of the program. While getting your feet on the ground you may want
additional input from an aware human. He should be given a chance to
intervene in the normal constructor/destructor cycle.
Note that, in general, it doesn't make sense to store pointers -- store the
thing pointed to.
I think your friend was simply pointing out that the save and restore are
accomplished using the stuff in <iostream>