home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / gnu / ixemul-39.47-env-bin.lha / man / cat3 / fgets.0 < prev    next >
Text File  |  1993-12-07  |  3KB  |  67 lines

  1.  
  2. FGETS(3)                   UNIX Programmer's Manual                   FGETS(3)
  3.  
  4. NNAAMMEE
  5.      ffggeettss, ggeettss - get a line from a stream
  6.  
  7. SSYYNNOOPPSSIISS
  8.      ##iinncclluuddee <<ssttddiioo..hh>>
  9.  
  10.      _c_h_a_r _*
  11.      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)
  12.  
  13.      _c_h_a_r _*
  14.      ggeettss(_c_h_a_r _*_s_t_r)
  15.  
  16. DDEESSCCRRIIPPTTIIOONN
  17.      The ffggeettss() function reads at most one less than the number of characters
  18.      specified by size from the given _s_t_r_e_a_m and stores them in the string
  19.      _s_t_r. Reading stops when a newline character is found, at end­of­file or
  20.      error.  The newline, if any, is retained.  In any case a `\0' character
  21.      is appended to end the string.
  22.  
  23.      The ggeettss() function is equivalent to ffggeettss() with an infinite size and a
  24.      _s_t_r_e_a_m of _s_t_d_i_n, except that the newline character (if any) is not stored
  25.      in the string.  It is the caller's responsibility to ensure that the in­
  26.      put line, if any, is sufficiently short to fit in the string.
  27.  
  28. RREETTUURRNN VVAALLUUEESS
  29.      Upon successful completion, ffggeettss() and ggeettss() return a pointer to the
  30.      string.  If end­of­file or an error occurs before any characters are
  31.      read, they return NULL. The ffggeettss() and functions ggeettss() do not distin­
  32.      guish between end­of­file and error, and callers must use feof(3) and
  33.      ferror(3) to determine which occurred.
  34.  
  35. EERRRROORRSS
  36.      [EBADF]  The given _s_t_r_e_a_m is not a readable stream.
  37.  
  38.      The function ffggeettss() may also fail and set _e_r_r_n_o for any of the errors
  39.      specified for the routines fflush(3),  fstat(2),  read(2),  or malloc(3).
  40.  
  41.  
  42.      The function ggeettss() may also fail and set _e_r_r_n_o for any of the errors
  43.      specified for the routine getchar(3).
  44.  
  45. SSEEEE AALLSSOO
  46.      feof(3),  ferror(3),  fgetline(3)
  47.  
  48. SSTTAANNDDAARRDDSS
  49.      The functions ffggeettss() and ggeettss() conform to ANSI C3.159­1989 (``ANSI
  50.      C'').
  51.  
  52. BBUUGGSS
  53.      Since it is usually impossible to ensure that the next input line is less
  54.      than some arbitrary length, and because overflowing the input buffer is
  55.      almost invariably a security violation, programs should _N_E_V_E_R use ggeettss().
  56.      The ggeettss() function exists purely to conform to ANSI C3.159­1989 (``ANSI
  57.      C'').
  58.  
  59. BSD Experimental                 June 29, 1991                               1
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.