fread, fwrite - buffered binary input/output
int fread (ptr, size, nitems, stream)
int fwrite (ptr, size, nitems, stream)
fread() reads, into a block pointed to by ptr, nitems items of data
from the named input stream stream, where an item of data is a sequence
of bytes (not necessarily terminated by a null byte) of length size.
It returns the number of items actually read. fread() stops reading if
an end-of-file or error condition is encountered while reading from
stream, or if nitems items have been read. fread() leaves the file
pointer in stream, if defined, pointing to the byte following the last
byte read if there is one. fread() does not change the contents of the
file referred to by stream .
fwrite() writes at most nitems items of data from the block pointed to
by ptr to the named output stream stream. It returns the number of
items actually written. fwrite() stops writing when it has written
nitems items of data or if an error condition is encountered on stream.
fwrite() does not change the contents of the block pointed to by ptr.
If size or nitems is non-positive, no characters are read or written
and 0 is returned by both fread() and fwrite().
read(2V), write(2V), fopen(3V), getc(3V), gets(3S), putc(3S), puts(3S),
fread() and fwrite() return 0 upon end of file or error.
7 September 1988 FREAD(3S)