- Nov 16, 2000
- 8,659
- 1
- 81
I have this code snip...
while(getline(inScoresFile, name))
{
getline(inScoresFile, grades);
cout << name << grades << endl;
}
And for the buffer named grades on line 3, I want to be able to "parse a buffer" to get intergers out of it, but It's stored as string, any ideas? I want to store whats in the string grades into variables i, j, k respectivly.
The file looks like
I tried to just go straight up with insertion operators, inScoresFile >> i >> j >> k, but the loop doesnt continue for all the names in the file.
Name Lastname
10 20 30
Name AnotherName
40 50 60
and so on.....
while(getline(inScoresFile, name))
{
getline(inScoresFile, grades);
cout << name << grades << endl;
}
And for the buffer named grades on line 3, I want to be able to "parse a buffer" to get intergers out of it, but It's stored as string, any ideas? I want to store whats in the string grades into variables i, j, k respectivly.
The file looks like
I tried to just go straight up with insertion operators, inScoresFile >> i >> j >> k, but the loop doesnt continue for all the names in the file.
Name Lastname
10 20 30
Name AnotherName
40 50 60
and so on.....