hello everyone,I am trying to read data from a text file,such as
1234567
1234567
1234567
but i found that when reading the text file, there is an extra loop counted by the eof loop, the result become:
1234567
1234567
12345677
an extra "7" appear, did i do something wrong?
eof() does not return true until you have already tried and failed to read the last character of the file. So on the second to last loop, eof() is still not true because you haven't tried to read *past* the last character.