4.3BSD/usr/man/man3/fread.3s

.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)fread.3s	6.1 (Berkeley) 5/15/85
.\"
.TH FREAD 3S  "May 15, 1985"
.UC 4
.SH NAME
fread, fwrite \- buffered binary input/output
.SH SYNOPSIS
.B #include <stdio.h>
.PP
.B fread(ptr, sizeof(*ptr), nitems, stream)
.br
.SM
.B FILE
.B *stream;
.PP
.B fwrite(ptr, sizeof(*ptr), nitems, stream)
.br
.SM
.B FILE
.B *stream;
.SH DESCRIPTION
.I Fread
reads, into a block beginning at
.IR ptr ,
.I nitems
of data of the type of
.I *ptr
from the named input
.IR stream .
It returns the number of items actually read.
.PP
If
.I stream
is
.B stdin
and the standard output is line buffered, then any partial output line
will be flushed before any call to
.IR read (2)
to satisfy the
.IR fread .
.PP
.I Fwrite
appends at most
.I nitems
of data of the type of
.I *ptr
beginning at
.I ptr
to the named output
.IR stream .
It returns the number of items actually written.
.SH "SEE ALSO"
read(2),
write(2),
fopen(3S),
getc(3S),
putc(3S),
gets(3S),
puts(3S),
printf(3S),
scanf(3S)
.SH DIAGNOSTICS
.I Fread
and
.I fwrite
return
0
upon end of file or error.