Table of Contents
The
function reads at most one less than the number of characters specified
by from the given and stores them in the string Reading stops when a
newline character is found, at end-of-file or error. The newline, if any,
is retained. In any case a character is appended to end the string. The
function is equivalent to with an infinite and a of 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, and return
a pointer to the string. If end-of-file or an error occurs before any characters
are read, they return The and functions do not distinguish between
end-of-file and error, and callers must use and to determine which occurred.
The given is not a readable stream. The function may also fail
and set for any of the errors specified for the routines or The function
may also fail and set for any of the errors specified for the routine
The functions and conform to
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 should use The function exists purely to
conform to
Table of Contents