Goodnight.
There is a piece of code that reads lines from a file:
while((i<num) && (!fin.eof())) { //что-то //после каждой считанной строки из файла выводится выводится строка в консоль. } And there is a file with such content (the file ends at the end of line 5, there are no more characters):
1 hello helo 0 0 2 hello helo 2 4 3 hello helo 4 8 4 hello helo 6 12 5 hello helo 8 16
When num = 5, it reads correctly all 5 lines, if n = 6 and more, then something else is read and outputs 1 line more. It seems that eof finds the end of the file not at the end of line 5, but at the beginning of 6 O_o. What could be the error?
A string is written to the file with << endl; at the end.