saveing class to binary file c++

Started by
3 comments, last by wood_brian 13 years, 6 months ago
Hi all,
If any of you noticed I have posted 3 questions in the wrong forum, which I am apologise for and
Hope-fully won't do it again.
Now my question

I am trying to save some game settings n a bnary file but I think it isn't working 100%
Becouse the window caption is stored in the settings fle and the capton shws squers and a letter,
The overiew of the code is as follows

I create a fstream object set it up
The use the write function, for the first parameter I use reinterprit_cate

Anf that is just about all the code that I use or it
Thank for the awnsours.

Never say Never, Because Never comes too soon. - ryan20fun

Disclaimer: Each post of mine is intended as an attempt of helping and/or bringing some meaningfull insight to the topic at hand. Due to my nature, my good intentions will not always be plainly visible. I apologise in advance and assure you I mean no harm and do not intend to insult anyone.

Advertisement
Most C++ classes you just can't reinterpret_cast and have it work with fstream::write(). You need to think about the actual data involved. For an overview of the topic see this.
And have a look at boost::serialization to do some of that heavy lifting for you.
Thanks,
Ill gong to look into the providd links

Never say Never, Because Never comes too soon. - ryan20fun

Disclaimer: Each post of mine is intended as an attempt of helping and/or bringing some meaningfull insight to the topic at hand. Due to my nature, my good intentions will not always be plainly visible. I apologise in advance and assure you I mean no harm and do not intend to insult anyone.

You could consider using the C++ Middleware Writer. It's an on line code generator that writes low-level C++ marshalling code based on high-level user input. There are advantages to using the C++ Middleware Writer over other serialization libraries.

I'm interested in helping people get started using the C++ Midleware Writer. I'm willing to donate 20 hours a week for six months on the right project. Let me know if you agree with the following and are interested in my offer.

Therefore, a man should endeavor to marry the daughter of a Torah scholar, marry his daughter to a Torah scholar, eat and drink with Torah scholars and do business with Torah scholars.


This topic is closed to new replies.

Advertisement