The way I am currently doing it is:
string filename, line;
int test = 0;
ifstream infile(filename);
if (!infile){
cout << "Could not open file" << endl;
return 1;
}
while (getline(infile, line))
{
for (string::iterator it = line.begin(); it < line.end(); it++)
{
if (*it == 'i'){
it++;
test = 0;
while (*it > 47 && *it < 58){
test = test * 10;
test = test + (*it - '0');
it++;
}
cout << test << " ";
it--;
}
}
}
infile.close();






