What is any easy way, if any, to save and load data in c++?
Compiler-Devcpp Os-Windows ME
This is a discussion on Data Saving and Loading within the C++ Programming forums, part of the General Programming Boards category; What is any easy way, if any, to save and load data in c++? Compiler-Devcpp Os-Windows ME...
What is any easy way, if any, to save and load data in c++?
Compiler-Devcpp Os-Windows ME
Save/read your object to/from files. Overload insertion (<<) and extraction (>>) operators for your object to make things easy.
I used to be an adventurer like you... then I took an arrow to the knee.
Do i use the fstrem.h header? And do i use a text file or what?
Yes, use an fstream object
Eg
Saving would be
fout << name << age;
Loading would be
fin >> name >> age;
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I support http://www.ukip.org/ as the first necessary step to a free Europe.
ive been making a program to keep track of mountain dew ive sold in school
ive used text files to keep track and works very well when i save info but ive been trying to comprehend an easy way to read from my file all i can think of is reading numbers from the text file but wouldnt that have to be saved as a string?