4.3BSD-UWisc/man/cat3/fread.3s




FREAD(3S)           UNIX Programmer's Manual            FREAD(3S)



NAME
     fread, fwrite - buffered binary input/output

SYNOPSIS
     #include <stdio.h>

     fread(ptr, sizeof(*ptr), nitems, stream)
     FILE *stream;

     fwrite(ptr, sizeof(*ptr), nitems, stream)
     FILE *stream;

DESCRIPTION
     _F_r_e_a_d reads, into a block beginning at _p_t_r, _n_i_t_e_m_s of data
     of the type of *_p_t_r from the named input _s_t_r_e_a_m.  It returns
     the number of items actually read.

     If _s_t_r_e_a_m is stdin and the standard output is line buffered,
     then any partial output line will be flushed before any call
     to _r_e_a_d(2) to satisfy the _f_r_e_a_d.

     _F_w_r_i_t_e appends at most _n_i_t_e_m_s of data of the type of *_p_t_r
     beginning at _p_t_r to the named output _s_t_r_e_a_m.  It returns the
     number of items actually written.

SEE ALSO
     read(2), write(2), fopen(3S), getc(3S), putc(3S), gets(3S),
     puts(3S), printf(3S), scanf(3S)

DIAGNOSTICS
     _F_r_e_a_d and _f_w_r_i_t_e return 0 upon end of file or error.
























Printed 12/27/86          May 15, 1985                          1