My $0.02...
In C++, getline() returns the file stream that is being used; and when a file-stream is operated on as a conditional value, it is converted to a bool via a converter method that is associated with the stream object.
Thus, the following code:
Code:
...
while(!myfile.eof()) {
getline(myfile, line);
...
}
can be reduced to:
Code:
...
while (getline(myfile, line)) {
...
}