Is there a function that will allow me to store data?

I need help with making a function that will allow me to store things somewhere like an inventory system in a text-based game.
you could look into using the <fstream> package of C++, which allows reading and writing from text files. is that what you're looking for?
you could possibly use a class object and a member function that creates an outfile...if you're like me,and taking classes in c++, if you haven't got to the file output and input you will soon, and that should clear things up pretty well.

JUST A BEGINNER MYSELF, so i hope someone else clarifies here, but... if you use a class that creates a class object, you can store multiple data types in the class object so they are all associated to one object.. for your purposes a class is like a character sheet with blanks, and a class object is a filled in version.. then if you outfile it you can create a saved file like a .dat file that the program can recall next time you run it, A.K.A. next time you play the game... then just include code to recall the class object and pass the data to the appropriate lines of code or functions that need it..
Topic archived. No new replies allowed.