I have to read a file that contains a list of paths which are stored in a vector.
    vector<string> files;
    ifstream in;
    string x;
    while( !in.eof() ) {
       in >> x;
       files.push_back(x);
    }
but the problem is that when the last path is read in.eof() is still false and the loop continue for another unwanted step. A fix could be a thing like this
    vector<string> files;
    ifstream in;
    string x;
    while( in >> x ) {
       files.push_back(x);
    }
but I think that isn't a great solution in the case of a more complex code in the while loop. Am I wrong?
 
     
    