How do I make save files for a game? How to store and recall variables to a file the user would name is basically what im asking. PS this is going to be a text based RPG if you need to know.
How do I make save files for a game? How to store and recall variables to a file the user would name is basically what im asking. PS this is going to be a text based RPG if you need to know.
Signature is optional, I didnt opt for one.
The first thing you need to do is to search the board for things that have to do with file handling.
This is a topic that has been addressed frequently on this board by looking at the results of a search done using the search button on the top right hand side of the screen.
The first decision you need to make is what to store. Do you wish to store a users name, scores, place in program at time of closure, whatever. Then you need to decide how you are going to store the information--unrelated data variables and data variables enclosed in a struct/class are two common methods. Last you need to decide which style of file handling you wish to use. Choices here include C style FILE * with associated functions like fwrite(), fread(), fscanf(), fprintf(), etc.---OR---C++ style streams such as fstreams which can be used to both read and write files or dediciated streams like ofstream to write to file and ifstream to read from file.
So...think about what you want to do. Review some of the posts already available on the board. Review appropriate sections on file handling in your favorite textbook/tutorial. Give a go, Joe. And if you have specific questions post them with pertinent code and/or error messages.
Go for it!
It's in the tutorials