summaryrefslogtreecommitdiffstats
path: root/man3const
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2022-10-14 21:15:28 +0200
committerAlejandro Colomar <alx@kernel.org>2022-10-18 19:44:47 +0200
commitcfd962670728f8f00d5ac0dd57f48fa4b92236de (patch)
treed5c1df4c004eaf462a08e1bf8c074188c5240fa1 /man3const
parent34caa7cd4d50f4ab306c18d5fc07c5619f237aea (diff)
EOF.3const: Add documentation for EOF
Reported-by: "G. Branden Robinson" <g.branden.robinson@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'man3const')
-rw-r--r--man3const/EOF.3const42
1 files changed, 42 insertions, 0 deletions
diff --git a/man3const/EOF.3const b/man3const/EOF.3const
new file mode 100644
index 000000000..0f97ca676
--- /dev/null
+++ b/man3const/EOF.3const
@@ -0,0 +1,42 @@
+.\" Copyright (c) 2022 by Alejandro Colomar <alx@kernel.org>
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.\"
+.TH EOF 3const (date) "Linux man-pages (unreleased)"
+.SH NAME
+EOF \- end of file or error indicator
+.SH LIBRARY
+Standard C library
+.RI ( libc )
+.SH SYNOPSIS
+.nf
+.B #include <stdio.h>
+.PP
+.B "#define EOF /* ... */"
+.fi
+.SH DESCRIPTION
+.B EOF
+represents the end of an input file, or an error indication.
+It is a negative value, of type
+.IR int .
+.PP
+.B EOF
+is not a character
+(it can't be represented by
+.IR "unsigned char" ).
+It is instead a sentinel value outside of the valid range for valid characters.
+.SH CONFORMING TO
+C99 and later;
+POSIX.1-2001 and later.
+.SH 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.
+.SH SEE ALSO
+.BR feof (3),
+.BR fgetc (3)