Data stream help

G

gurumare

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)
 
O

osmium

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,661
Latest member
sxarexu

Latest Threads

Top