Jump to content
  • Advertisement
Sign in to follow this  
MSalley

Saving

This topic is 4845 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How do I save info that was input during a console based app? For use the next time I run it? I have profiles of people(like an address book), and I want to be able to add new ones when I run it each time, and recall the ones that were added in previous executions of the program?

Share this post


Link to post
Share on other sites
Advertisement
You will have to develop some sort of save file format of your own, and use file i/o to read/write upon loading and exiting of the program. What language are you using?

Share this post


Link to post
Share on other sites
I would suggest just reading and writing the data to and from a text file. Then when the application loads, read the whole file into a map or vector (map is quicker) add to it, then iteraate through the map or vector writin them out to the same file.

ace

Share this post


Link to post
Share on other sites
I think that you will need to include fstream.

Like so to write to a file:

#include <fstream>
using namespace std;

int main()
{
ofstream File ( "NameOfFile" );
File<<"TextToPrint";
File.close;
return 0;
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!