Manual page for FREAD(3S)
fread, fwrite - buffered binary input/output
SYNOPSIS
#include <stdio.h>
int fread (ptr, size, nitems, stream)
char *ptr;
int size;
int nitems;
FILE *stream;
int fwrite (ptr, size, nitems, stream)
char *ptr;
int size;
int nitems;
FILE *stream;
DESCRIPTION
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().
SEE ALSO
read.2v
write.2v
fopen.3v
getc.3v
gets.3s
putc.3s
puts.3s
printf.3v
scanf.3v
DIAGNOSTICS
fread()
and
fwrite()
return 0 upon end of file or error.
Created by unroff & hp-tools.
© somebody (See intro for details). All Rights Reserved.
Last modified 11/5/97