-
Notifications
You must be signed in to change notification settings - Fork 2
/
fread.3
66 lines (65 loc) · 1.31 KB
/
fread.3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
.\" 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 3 "May 15, 1985"
.UC 4
.SH NAME
fread, fwrite \- buffered binary input/output
.SH SYNOPSIS
.nf
.ft B
#include <sys/types.h>
#include <stdio.h>
size_t fread(void *\fIptr\fP, size_t \fIitemsize\fP, size_t \fInitems\fP, FILE *\fIstream\fP)
size_t fwrite(void *\fIptr\fP, size_t \fIitemsize\fP, size_t \fInitems\fP, FILE *\fIstream\fP)
.SH DESCRIPTION
.B 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
.BR read (2)
to satisfy the
.BR fread .
.PP
.B 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"
.BR read (2),
.BR write (2),
.BR fopen (3),
.BR getc (3),
.BR putc (3),
.BR gets (3),
.BR puts (3),
.BR printf (3),
.BR scanf (3).
.SH DIAGNOSTICS
.B Fread
and
.B fwrite
return
0
upon end of file or error.