How to read a growing text file in C++?
The loop is incorrect as when eof() is encountered tellg() returns -1 and there is no check for eof() immediately after the call to getline() which there needs to be. Change loop to: while (getline(ifs, log)) { cout << log << endl; p = ifs.tellg(); } Additionally, as p is declared as a size_t when … Read more