Looking for better way to write/read files

I'm creating a game in which many variables need to be saved fairly often and at different times.

I understand and have used std::fstream before, but i don't think pasting all of my variables into a single text(/binary) file is efficient for reading, or modifying a single variable. It would be possible to save a different file for each variable, although having 100 files inside of a folder seems messy and inefficient; so far that is the best thing i could come up with. Although it seems that in every other game out there it is all saved into a single "save" file.

Just wondering if there is a more efficient way to do it, perhaps a library I can look into that lets me save individual variables into a single file? thanks in advance.
Writing one file with 100 variables is more efficient than writing 100 files with 1 variable. If you use a binary format reading or writing 100 variables should not take long. Fastest is probably if you store all variables in a struct and write the struct in one go.
Topic archived. No new replies allowed.