I'm trying to make a program that will read names and numbers from a file, but I'm quite inexperienced in C++ in general, and most tutorials and help threads I read tend to make me confused.
So far, I have used a test file with a text like "NameA 01234 NameB 11111 NameC 55555". I want the names in one string and the numbers in another one, which I have managed to do with the code:
ifstream in("test.txt"); string inName, inChar; for (int i= 0; i<3; i++) in >> plant[i].name >> plant[i].charString
My problem now is that the file I actually want to read from is more complicated, and looks more like:
"LotsOfTextThat;IAmNotInterestedIn; MATRIXNameA 01234 NameB 11111 NameC 55555; MoreTextThatIsOfNoUse".
In other words, I want to start reading after the word "MATRIX" and stop at the character ";". How do I edit my code to make it do that?