$manlookup

EOF

(3const)

end of file or error indicator

Library functionsmanpages-dev 6.9.1-1
#include <stdio.h> #define EOF /* ... */

LIBRARY

Standard C library (libc)

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 unsigned char). It is instead a sentinel value outside of the valid range for valid characters.

STANDARDS

C11, POSIX.1-2008.

HISTORY

C89, POSIX.1-2001.

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.

See also