As you give more details of the problem, the solution begins to get clearer.
My advice is to break down the problem into smaller pieces. In this case, I would leave the code I suggested yesterday as it is.
What I would do is take the string such as "int Bob" or "float taxYear=2013" and consider that on its own. (It might be a good idea to use a separate function for handling this). Imagine you had a file which contained only "int Bob", think of the problem in that way.
Now you can do exactly that, using a stringstream. This allows you to use a string as though it was an input file (or as an output file).
For example,
1 2 3 4 5 6 7
|
string input = "int Bob";
istringstream ss(input);
string word;
while (ss >> word)
{
cout << "word is: " << word << '\n';
}
|
Of course, instead of supplying the value for
input
as I've done here, you'd use the segment read from your file.
See the example in the reference pages:
http://www.cplusplus.com/reference/sstream/istringstream/istringstream/
It's possible that this is a false start and my advice is complete rubbish here. Because I don't have a full view of the problem, and where it is heading, this approach may be unsuitable.