Jump to content
  • Advertisement
Sign in to follow this  
Jemburula

Saving Class Data to a file

This topic is 4636 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, Wasn't exactly sure what term to search for when researching how to do this but: I've created a class for each person in say a team and inputted all their data etc, so now I want to save the "state" I suppose of each person in the same text file such as "Team1.txt" sort of thing. That being said then I want to be able to load the data back up and reinitialize a each class. I haven't a clue where to start with converting the data or anything so if someone could point me in the right direction or some buzzwords etc it would be very much appreciated. I'm using C++ on Windows, thanks again everyone. Jemburula

Share this post


Link to post
Share on other sites
Advertisement
Serialization is a very nice way of saving binary data to files. Could be exactly what you're looking for. If you're looking for a more organized way of presenting it in the text file, I'd suggest looking into either XML files or a variation of config files.

Share this post


Link to post
Share on other sites
Ah thank you both very much, I followed your link on serialization Rob and just whipped up a quick test and it worked like a charm. I would of tried tinyxml because I've heard of it quite alot, but I'm pretty new to using all new libraries etc so perhaps another time. Thanks again both of you.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!