C++ how to make game save file

I'm currently making a RPG game and was wondering how would I make the game to save everything into a file then load it and set all the variables
1
2
3
4
Health 100
Weapon Random_Axe
Gold 100
Name Random_Name

Then the code will go through the text file and set all the variables to their corresponding variable. How would you go about doing this?
Topic archived. No new replies allowed.