I am trying to write a databasing program to store information about people, such as DOB, address, etc.
What I am trying to do is write all of these entries into a file, and then use the file to read off of.
My question is how to index the file to make it search-able in order to delete specific entries, and also how to write different entries on different lines.
Here is my code thus so far (adding and deleting are functions of the class people)
Well, you could either use a vector or a map to store the data from the file. A vector is more general purpose (you just store the strings), and a map is more "searchable" since it uses a "key". However, if you want the person to be able to input any search term (name, address, etc) I would use a vector.
Then, just go through the vector (or map) and use the string functions to find the information you are looking for.
Also, can you tell me how to write to the end of the file, as opposed to writing over the information already in it as my code does now, or do I have to copy the entire file to memory, and then out put the file at the end of my operations on it?