i am trying to read a file in c. i have a .txt file and it has that content:
file_one.txt file_two.txt file_three.txt file_four.txt
when i try to read this
The \377
is an octal escape sequence, decimal 255, all bits set. It comes from converting EOF
- which usually has the value -1
- to a char
, due to
while (!feof(filelist)) {
feof(filelist)
only becoming true after you have tried to read past the file.
So at the end of the file, you enter the loop once more, and the getc()
returns EOF
.