home *** CD-ROM | disk | FTP | other *** search
-
- FGETS(3) UNIX Programmer's Manual FGETS(3)
-
- NNAAMMEE
- ffggeettss, ggeettss - get a line from a stream
-
- SSYYNNOOPPSSIISS
- ##iinncclluuddee <<ssttddiioo..hh>>
-
- _c_h_a_r _*
- ffggeettss(_c_h_a_r _*_s_t_r, _s_i_z_e___t _s_i_z_e, _F_I_L_E _*_s_t_r_e_a_m)
-
- _c_h_a_r _*
- ggeettss(_c_h_a_r _*_s_t_r)
-
- DDEESSCCRRIIPPTTIIOONN
- The ffggeettss() function reads at most one less than the number of characters
- specified by size from the given _s_t_r_e_a_m and stores them in the string
- _s_t_r. Reading stops when a newline character is found, at endoffile or
- error. The newline, if any, is retained. In any case a `\0' character
- is appended to end the string.
-
- The ggeettss() function is equivalent to ffggeettss() with an infinite size and a
- _s_t_r_e_a_m of _s_t_d_i_n, except that the newline character (if any) is not stored
- in the string. It is the caller's responsibility to ensure that the in
- put line, if any, is sufficiently short to fit in the string.
-
- RREETTUURRNN VVAALLUUEESS
- Upon successful completion, ffggeettss() and ggeettss() return a pointer to the
- string. If endoffile or an error occurs before any characters are
- read, they return NULL. The ffggeettss() and functions ggeettss() do not distin
- guish between endoffile and error, and callers must use feof(3) and
- ferror(3) to determine which occurred.
-
- EERRRROORRSS
- [EBADF] The given _s_t_r_e_a_m is not a readable stream.
-
- The function ffggeettss() may also fail and set _e_r_r_n_o for any of the errors
- specified for the routines fflush(3), fstat(2), read(2), or malloc(3).
-
-
- The function ggeettss() may also fail and set _e_r_r_n_o for any of the errors
- specified for the routine getchar(3).
-
- SSEEEE AALLSSOO
- feof(3), ferror(3), fgetline(3)
-
- SSTTAANNDDAARRDDSS
- The functions ffggeettss() and ggeettss() conform to ANSI C3.1591989 (``ANSI
- C'').
-
- BBUUGGSS
- 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 _N_E_V_E_R use ggeettss().
- The ggeettss() function exists purely to conform to ANSI C3.1591989 (``ANSI
- C'').
-
- BSD Experimental June 29, 1991 1
-
-
-
-
-
-
-
-