Well, I'm working on a simple project but I've hit a snag in my progress so far. I'd like to take a file that has text which will be something similar to:
Placemarker 1 = words/numbers Placemarker 2 = words/numbers Placemarker 3 = words/numbers
so you'll have a file like:
Name = Bob Job = Student Whatever = stuff Name = John Job = Student Whatever = things
The place markers are just for readabilty of the resulting text file.
So I'd like to know how to use C++ (maybe fstream?) to:
a. check for the placemarker
b. if the marker is the one I want (like "Name") skip to the "= " and take the value after that to be placed in a temp variable for checking.
c. See if the variable (such as "Bob") matches the one I want
d. Then repeat the process so many times line by line (to maybe input into a structure of values) until it hits the blank line and will then stop.
So the user could type in "Bob", the set text file "whatever.txt" would be opened, name lines would be found, then checked for "Bob", then input the data if matched.
I (obviously) don't know enough about C++ I/O and fstream to figure this out, but I am already thinking that a set number of characters (include spaces) between the start of the marker ("|Name") and the end of the = thing ("= |") should be a set number of characters.
Any help/suggestions/links as to how to go about this would be much appreciated.