What is xBuf?
What is a String? Is it similar to a std::string?
You can't do binary read/write with classes that manage dynamic allocated data (like std::string or std::vector)
You will be just saving the pointer, and that is useless.
I got all excited when i read this because i saw the missing break and thought i actually knew this one but then i heard it doesnt fix the problem so i guess it doesnt count :(
I've done all that. When I cout it shows me the correct information on the first line and then it shows me numbers that aren't in the file at all.
Sample file:
Add 0123766891 Tom Sawyer Twain, Mark 2 8.50 fiction
Delete 0243578325 Romeo and Juliet Shakespeare, William 6 4.99 drama
Sample file:
Add 0123766891 Tom Sawyer Twain, Mark 2 8.50 fiction
Delete 0243578325 Romeo and Juliet Shakespeare, William 6 4.99 drama
Is this a text file? You read it using unformatted i/o - that is the read(..) method. If indeed the data is in text form, you will need to convert the action strings (Add/Delete..) into the corresponding numbers manually in your code. But that is only if the data is stored as text. Then, you will need to implement the parsing.
The ToDo field has correct input but switch will only work for first line.
What do you mean by "for the first line?" Do you mean that only one iteration of the loop is performed or that only the first action is always opted. I assumed the latter, but if it is the former, then may be an exception takes place.
I mean, to have the proper value and still go to the wrong case means a compiler bug. Stuff happens, but...