From what I understand, you have something like this:
std::ifstream file("file.txt");
std::string line;
while(getline(file,line)) {
//read the line
}
I also gather (correct me if I'm wrong) that at the end of your file, you have TWO newlines, like this:
line1\nline2\n\n
If this is the case, the while loop body will for sure be executed on one empty line at the end. To get around this, just ignore the empty line:
while(getline(file,line)) {
if (line == "") continue;
//read the line
}
If this doesn't work, it's because I misunderstood your question, and in this case please provide some more details.