.\" Copyright (c) 1990 The Regents of the University of California.
.\" %sccs.include.redist.man%
.\" @(#)fgetln.3 5.1 (Berkeley) %G%
fgetline \- get a line from a stream
fgetline(FILE *stream, size_t *len);
returns a pointer to the next line from the stream pointed to by
The newline character at the end of the line is replaced by a '\e0'
is non-NULL, the length of the line, not counting the terminating
NUL, is stored in the memory location it references.
ferror(3), fgets(3), fopen(3), putc(3)
Upon successful completion a pointer is returned;
this pointer becomes invalid after the next I/O operation on
(whether successful or not)
or as soon as the stream is closed.
Otherwise, NULL is returned.
does not distinguish between end-of-file and error, and callers must use
to determine which occurred.
If an error occurrs, the global variable
is set to indicate the error.
The end-of-file condition is remembered, even on a terminal, and all
subsequent attempts to read will return NULL until the condition is
It is not possible to tell whether the final line of an input file
was terminated with a newline.
The text to which the returned pointer points may be modified,
provided that no changes are made beyond the terminating NUL.
These changes are lost as soon as the pointer becomes invalid.
is not a stream open for reading.
for any of the errors specified for the routines