I am trying to count the number of lines in an excel sheet with the following code
line_count = 0;
while (!GBplaces.eof()){
string Line;
getline(GBplaces, Line);
cout << Line << endl;
line_count++;
cout << line_count << endl;
}
There are only 101 lines on the excel sheet. However, with this code I get line_count = 102, as it appears that an extra blank line is counted. Why is that so? Does .eof() not make the line counting stop when the last line is reached?