.\" Copyright (c) 1990, 1991 The Regents of the University of California.
.\" This code is derived from software contributed to Berkeley by
.\" Chris Torek and the American National Standards Committee X3,
.\" on Information Processing Systems.
.\" %sccs.include.redist.man%
.\" @(#)fgets.3 6.9 (Berkeley) %G%
.Nd get a line from a stream
.Fn fgets "char *str" "size_t size" "FILE *stream"
reads at most one less than the number of characters specified by
and stores them in the string
Reading stops when a newline character is found,
The newline, if any, is retained.
character is appended to end the string.
except that the newline character (if any) is not stored in the string.
It is the caller's responsibility to ensure that the input line,
if any, is sufficiently short to fit in the string.
Upon successful completion,
If end-of-file or an error occurs before any characters are read,
do not distinguish between end-of-file and error, and callers must use
to determine which occurred.
is not a readable stream.
for any of the errors specified for the routines
for any of the errors specified for the routine
Since it is usually impossible to ensure that the next input line
is less than some arbitrary length, and because overflowing the
input buffer is almost invariably a security violation, programs
exists purely to conform to