saving a value to a nother folder to be retreived

If i were making a game that is entirely text based. When the player gets an item, it is stored like:
int gun = 1
everytime he needs to use the gun, he needs to have that integer.
how would i save the integer *gun* or other values to a folder that the program first checks if it exists, if it exists it gets all the values from it, and if it doesnt then it creates that folder and saves the default values to it.
Thanks!
i hope you guys can help me!

(or gals. iether way works...)
yeah, you just need to look up fstreams

here:

http://www.cplusplus.com/doc/tutorial/files/

if you have any problems understanding that stuff, I can help you

I assume you want to store the value of gun in a file so you can get the value of gun when you next open up your program
your assumption is correct.
however, i could not see where it said "type this to get this value and save it as a value" on that page.
so i can now write words to a text file... can i write numbers so that when the program goes into that file, it knows wich words and numbers go together to make a coherent value?
and am i jst being stupid and its right there in that page and i cant find it?


edit::
hello?
Last edited on
Topic archived. No new replies allowed.