Hi, I'm a complete noob to C++. I am currently just making text games where you input a string and depending what that string is and what you have in your "inventory", the program will cout something else.
I would like to know how i would be able to save a value, like the intiger "gun", with a value of lets say 1 to say that you have it in your possession.
How would i save this value to a different folder that the program can later read? Like when the user types in "save", it saves all current values to a specific folder, and when the user gets back on, it checks to see if that folder exists, and then what the values are.
I'm in no great hurry, and would kind of like it if the basic stuff could be explained to me. I want to make a really long text game, but that requires saving.
(oops, im rambling...) Thanks!
Recommended Answers
Jump to PostDo you know how to write to a file? That's pretty much all you need to know.
Jump to PostGo Try http://www.cplusplus.com/doc/tutorial/files/, it has pretty much everything you need to know about basic writing to and from files.
Jump to PostCan you paste the code that you used to get the error : "file cannot be opened" ?
And
I don't get what you mean byi dont know how to make it so that it would get whatever is there to be placed as a value.
Jump to PostWe aren't psychic. You need to show us what you tried so we can help you fix it. Did you read the forum rules? Did you read any of the sticky posts at the top of the forum?
All 14 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.