Make all bucket and overflow addresses unsigned
[unix-history] / usr / src / lib / libc / stdio / fread.3
CommitLineData
411867e7
KB
1.\" Copyright (c) 1990 The Regents of the University of California.
2.\" All rights reserved.
74188ac6 3.\"
411867e7
KB
4.\" This code is derived from software contributed to Berkeley by
5.\" Chris Torek.
74188ac6 6.\"
411867e7
KB
7.\" %sccs.include.redist.man%
8.\"
1382c0b2 9.\" @(#)fread.3 6.4 (Berkeley) %G%
411867e7
KB
10.\"
11.TH FREAD 3 ""
12.UC 7
74188ac6 13.SH NAME
411867e7 14fread, fwrite \- stream binary input/output
74188ac6 15.SH SYNOPSIS
411867e7
KB
16.nf
17.ft B
18#include <stdio.h>
19
20int
21fread(void *ptr, size_t size, size_t count, FILE *stream);
22
23int
24fwrite(void *ptr, size_t size, size_t count, FILE *stream);
25.ft R
26.fi
74188ac6
KM
27.SH DESCRIPTION
28.I Fread
411867e7
KB
29reads
30.I count
31items of data, each
32.I size
33bytes long, from the given input
34.IR stream ,
35storing them at the location given by
36.IR ptr .
37It returns the actual count of items read
38(which will be less than
39.I count
40in the event of an
41.B EOF
42or error).
74188ac6 43.PP
1382c0b2
KB
44Fread does not distinguish between end-of-file and error, and callers
45must use
46.IR feof (3)
47and
48.IR ferror (3)
49to determine which occurred.
50.PP
74188ac6 51.I Fwrite
411867e7
KB
52writes
53.I count
54items of data, each
55.I size
56bytes long, to the given output
57.I stream ,
58obtaining them from the location given by
59.IR ptr .
60It returns the actual count of items written.
61.SH "RETURN VALUE"
62These functions return 0 (or a short count) upon end of file or error.
74188ac6 63.SH "SEE ALSO"
1382c0b2 64read(2), write(2)