Why don't you read the file line by line (using
std::getline[
^]), and search the
"new"
string inside the line? This way (on successful
find[
^] call) you
already have the needed line.
[updated]
Something like this (not tested):
do
{
getline( file, line);
if ( ! file.good() ) break; if ( line.find("new") != string::npos)
{
}
} while ( true );
[/updated]