EOF - end of file or error indicator
Contents
Caveats
Programs can't pass this value to an output function to "write" the end of a file. That would likely
result in undefined behavior. Instead, closing the writing stream or file descriptor that refers to such
file is the way to signal the end of that file.
Description
EOF represents the end of an input file, or an error indication. It is a negative value, of type int.
EOF is not a character (it can't be represented by unsignedchar). It is instead a sentinel value
outside of the valid range for valid characters.
History
C89, POSIX.1-2001.
Library
Standard C library (libc)
Name
EOF - end of file or error indicator
See Also
feof(3), fgetc(3) Linux man-pages 6.9.1 2024-05-26 EOF(3const)
Standards
C11, POSIX.1-2008.
Synopsis
#include<stdio.h>#defineEOF /* ... */
