14 March 2020
EOF is not a character
by Marco Bravo
Let’s recap the main points about EOF with added details for more clarity:
- EOF in ANSI C is not a character. It’s a constant defined in and its value is usually -1
- EOF is not a character in the ASCII or Unicode character set
- EOF is not a character that you find at the end of a file on Unix/Linux systems
- There is no explicit “EOF character” at the end of a file on Unix/Linux systems
- EOF(end-of-file) is a condition provided by the kernel that can be detected by an
application
when a read operation reaches the end of a file (if k is the current file position and m is the size of a file, performing a read() when k >= m triggers the condition)
Full article
tags: linux - eof - programming