
FGETLINE(3)                UNIX Programmer's Manual                FGETLINE(3)

NNAAMMEE
     ffggeettlliinnee - get a line from a stream

SSYYNNOOPPSSIISS
     ##iinncclluuddee <<ssttddiioo..hh>>

     _c_h_a_r _*
     ffggeettlliinnee(_F_I_L_E _*_s_t_r_e_a_m, _s_i_z_e___t _*_l_e_n)

DDEESSCCRRIIPPTTIIOONN
     The ffggeettlliinnee() function returns a pointer to the next line from the
     stream referenced by _s_t_r_e_a_m. The newline character at the end of the line
     is replaced by a NUL.

     If _l_e_n is non-NULL, the length of the line, not counting the terminating
     NUL, is stored in the memory location it references.

RREETTUURRNN VVAALLUUEESS
     Upon successful completion a pointer is returned; this pointer becomes
     invalid after the next I/O operation on _s_t_r_e_a_m (whether successful or
     not) or as soon as the stream is closed.  Otherwise, NULL is returned.
     The ffggeettlliinnee() function does not distinguish between end-of-file and er-
     ror; the routines feof(3) and ferror(3) must be used to determine which
     occurred.  If an error occurrs, the global variable _e_r_r_n_o is set to indi-
     cate the error.  The end-of-file condition is remembered, even on a ter-
     minal, and all subsequent attempts to read will return NULL until the
     condition is cleared with clearerr(3).

     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.

EERRRROORRSS
     [EBADF]  The argument _s_t_r_e_a_m is not a stream open for reading.

     The ffggeettlliinnee() function may also fail and set _e_r_r_n_o for any of the errors
     specified for the routines fflush(3),  malloc(3),  read(2),  stat(2),  or
     realloc(3).

SSEEEE AALLSSOO
     ferror(3),  fgets(3),  fopen(3),  putc(3)

HHIISSTTOORRYY
     The ffggeettlliinnee() function is currently under development.

BBUUGGSS
     It is not possible to tell whether the final line of an input file was
     terminated with a newline.

BSD Experimental                April 19, 1991                               1













