What are the different options for storing words and numbers from my C++ program?
For example, if I want to create an address book prog and I want to save various pieces of information about a person, not just retrieving their address, but the date of the last time I contacted them (or the last time I accessed their information), and maybe some other things.
So far, Ive just been writing everything to txt files. Is there a better way to do this? It seems like there should be a tidier method than having 100 txt files in a folder.
You can store everything in a single file, however making this robust enough can be a messy affair - that's why you usually delegate this job to a DBMS (e.g. SQLite) or to the file system (which is what you're doing now).
You could store everything in one file with commas and a 0 for a place holder if you did not have that info.
to store a lot of data, you might want 1 file per person also
You still keep the basic info in the main file below
filename000111.txt name addr city st zip phone1 phone2 email fax Bday
and in filename000111.txt you might keep a log of your calls, what you talked about, ag etc...
The benefit to the 2nd system is you don't have to read in as much if you just want a phone number. It's easier to keep lots of details, and it's easier to delete all the stuff for one person and know the rest are not effected.
I haven't done it that way in C++ but that is how it's done in a database, I figure it would be the same principle.