Also, I think you are making the serach more difficult than it needs to be:



std::string word;
bool bFound = false;

while ( !bFound && (file>>word) )
{
if (word ==...