home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / man / cat3 / funopen.0 < prev    next >
Text File  |  1993-12-07  |  4KB  |  133 lines

  1.  
  2. FUNOPEN(3)                 UNIX Programmer's Manual                 FUNOPEN(3)
  3.  
  4. NNAAMMEE
  5.      ffuunnooppeenn, ffrrooppeenn, ffwwooppeenn - open a stream
  6.  
  7. SSYYNNOOPPSSIISS
  8.      ##iinncclluuddee <<ssttddiioo..hh>>
  9.  
  10.      _F_I_L_E _*
  11.      ffuunnooppeenn(_v_o_i_d _*_c_o_o_k_i_e, _i_n_t _(_*_r_e_a_d_f_n_)_(_v_o_i_d _*_, _c_h_a_r _*_, _i_n_t_),
  12.              _i_n_t _(_w_r_i_t_e_f_n_*_)_(_v_o_i_d _*_, _c_o_n_s_t _c_h_a_r _*_, _i_n_t_),
  13.              _f_p_o_s___t _(_s_e_e_k_f_n_*_)_(_v_o_i_d _*_, _f_p_o_s___t_, _i_n_t_), _i_n_t _(_c_l_o_s_e_f_n_*_)_(_v_o_i_d _*_))
  14.  
  15.      _F_I_L_E _*
  16.      ffrrooppeenn(_v_o_i_d _*_c_o_o_k_i_e, _i_n_t _(_*_r_e_a_d_f_n_)_(_v_o_i_d _*_, _c_h_a_r _*_, _i_n_t_))
  17.  
  18.      _F_I_L_E _*
  19.      ffwwooppeenn(_v_o_i_d _*_c_o_o_k_i_e, _i_n_t _(_*_w_r_i_t_e_f_n_)_(_v_o_i_d _*_, _c_h_a_r _*_, _i_n_t_))
  20.  
  21. DDEESSCCRRIIPPTTIIOONN
  22.      The ffuunnooppeenn() function associates a stream with up to four ``I/O
  23.      functions''. Either _r_e_a_d_f_n or _w_r_i_t_e_f_n must be specified; the others can
  24.      be given as an appropriately­typed NULL pointer.  These I/O functions
  25.      will be used to read, write, seek and close the new stream.
  26.  
  27.      In general, omitting a function means that any attempt to perform the as­
  28.      sociated operation on the resulting stream will fail.  If the close func­
  29.      tion is omitted, closing the stream will flush any buffered output and
  30.      then succeed.
  31.  
  32.      The calling conventions of _r_e_a_d_f_n, _w_r_i_t_e_f_n, _s_e_e_k_f_n and _c_l_o_s_e_f_n must match
  33.      those, respectively, of read(2),  write(2),  seek(2),  and close(2) with
  34.      the single exception that they are passed the _c_o_o_k_i_e argument specified
  35.      to ffuunnooppeenn() in place of the traditional file descriptor argument.
  36.  
  37.      Read and write I/O functions are allowed to change the underlying buffer
  38.      on fully buffered or line buffered streams by calling setvbuf(3).  They
  39.      are also not required to completely fill or empty the buffer.  They are
  40.      not, however, allowed to change streams from unbuffered to buffered or to
  41.      change the state of the line buffering flag.  They must also be prepared
  42.      to have read or write calls occur on buffers other than the one most re­
  43.      cently specified.
  44.  
  45.      All user I/O functions can report an error by returning -1.  Additional­
  46.      ly, all of the functions should set the external variable _e_r_r_n_o appropri­
  47.      ately if an error occurs.
  48.  
  49.      An error on cclloosseeffnn() does not keep the stream open.
  50.  
  51.      As a convenience, the include file <_s_t_d_i_o_._h> defines the macros ffrrooppeenn()
  52.      and ffwwooppeenn() as calls to ffuunnooppeenn() with only a read or write function
  53.      specified.
  54.  
  55. RREETTUURRNN VVAALLUUEESS
  56.      Upon successful completion, ffuunnooppeenn() returns a FILE pointer.  Otherwise,
  57.      NULL is returned and the global variable _e_r_r_n_o is set to indicate the er­
  58.      ror.
  59.  
  60. EERRRROORRSS
  61.      [EINVAL]  The ffuunnooppeenn() function was called without either a read or
  62.                write function.  The ffuunnooppeenn() function may also fail and set
  63.                _e_r_r_n_o for any of the errors specified for the routine
  64.                malloc(3).
  65.  
  66. SSEEEE AALLSSOO
  67.      fcntl(2),  open(2),  fclose(3),  fopen(3),  fseek(3),  setbuf(3)
  68.  
  69. HHIISSTTOORRYY
  70.      These functions are currently under development.
  71.  
  72. BBUUGGSS
  73.      The ffuunnooppeenn() function may not be portable to systems other than BSD
  74.      UNIX.
  75.  
  76. BSD Experimental                April 19, 1991                               2
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.