|
-
Oct 31st, 2004, 07:44 PM
#1
Thread Starter
Frenzied Member
Saving a class to disk and then reading it back in
I am trying to save my program settings to disk but I cannot cast the data (a char*) to my class called Settings. This is done easily in C#, how do I do it in C++?
-
Oct 31st, 2004, 07:50 PM
#2
Thread Starter
Frenzied Member
I have to stop thinking with a C# mentality. I wasn't casting it to a pointer!
-
Nov 1st, 2004, 02:02 PM
#3
Direct serialization of class objects in C++ is highly complex and best avoided. Use alternative serialization. Save the data from the Settings class to a .ini, .properties or .xml, anything.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Nov 2nd, 2004, 06:24 PM
#4
Thread Starter
Frenzied Member
Is this ok?
Code:
class Settings
{
public:
BYTE brStyle0_1_2;
BYTE spAssignOp0_1_2;
bool spFuncsAndStructs;
bool spSemiColins;
bool spOperators;
bool replNullWZero;
bool spCommas;
Settings()
{
this->brStyle0_1_2= 2;
this->spAssignOp0_1_2= 1;
this->spFuncsAndStructs= 0;
this->spSemiColins= 1;
this->spOperators= 1;
this->spCommas= 1;
this->replNullWZero= 1;
}
};
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|