Ask coding questions

← Back to all posts
Best data saving method for C++?
tickedoffsquid (16)

Hello all! I am currently working on a game in C++, and need a way to store data (all of your variables and stuff) as a sort of "save" that can be easily deleted later, does anyone know the best way to do so?

xxpertHacker (865)

The closest to this that I've done is made programs that have configuration files.

I just read the data file, deserialize it into program values, and store them into variables.

A good example of a serialization format is JSON. It has to be the most overused data format that I've seen used with programming languages, especially Python and JavaScript.

You could use any format, just find a (good) library for reading/writing in/to it, and write it to a game data file for long term storage.