diff options
author | Alejandro Colomar <alx@kernel.org> | 2022-10-18 19:43:50 +0200 |
---|---|---|
committer | Alejandro Colomar <alx@kernel.org> | 2022-10-18 19:44:47 +0200 |
commit | 8265665575a9b5c7880be73f04eadc0aa8d8884e (patch) | |
tree | 9dc9f9ea3df19dae8e96fc3f6ce239668d154352 | |
parent | cfd962670728f8f00d5ac0dd57f48fa4b92236de (diff) |
ferror.3: CAVEATS: Need to get EOF before calling these functions
Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r-- | man3/ferror.3 | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/man3/ferror.3 b/man3/ferror.3 index b969aa01b..6e2818d4a 100644 --- a/man3/ferror.3 +++ b/man3/ferror.3 @@ -101,6 +101,20 @@ that these functions shall not change the value of if .I stream is valid. +.SH CAVEATS +Normally, +programs should read the return value of an input function, +such as +.BR fgetc (3), +before using functions of the +.BR feof (3) +family. +Only when the function returned the sentinel value +.B EOF +it makes sense to distinguish between the end of a file or an error with +.BR feof (3) +or +.BR ferror (3). .SH SEE ALSO .BR open (2), .BR fdopen (3), |