4BSD/usr/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(3), getc(3), putc(3), gets(3),
     puts(3), printf(3), scanf(3)

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

BUGS



















Printed 11/10/80                                                1