Saving a class.

Jun 23, 2010 at 6:12pm
Is there a quick and/or easy way to save a class to a file/disk?

For example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Player
{
public:
	Player(string name);
	~Player(){};
        //---functions left out---
private:
	double myLoca;
	int stat[200];
	short hand[30];
	short head[30];
	short body[30];
	short feet[30];
	bool trea[100];
	bool cond[10];
	short quest[100];
	string myName;
	float myAdren;
}


How could I save the data used in this class?
I've worked some with "ofstream", but it doesn't work.
Jun 23, 2010 at 6:25pm
Have a look at Boost.Serialization:
http://www.boost.org/doc/libs/1_43_0/libs/serialization/doc/index.html

but it doesn't work

Now that's a concise description of the problems you had with ofstream...
Last edited on Jun 23, 2010 at 6:31pm
Topic archived. No new replies allowed.