1FREAD(3S) FREAD(3S)
2
3
4
6 fread, fwrite - buffered binary input/output
7
9 #include <stdio.h>
10
11 fread(ptr, sizeof(*ptr), nitems, stream)
12 FILE *stream;
13
14 fwrite(ptr, sizeof(*ptr), nitems, stream)
15 FILE *stream;
16
18 Fread reads, into a block beginning at ptr, nitems of data of the type
19 of *ptr from the named input stream. It returns the number of items
20 actually read.
21
22 If stream is stdin and the standard output is line buffered, then any
23 partial output line will be flushed before any call to read(2) to sat‐
24 isfy the fread.
25
26 Fwrite appends at most nitems of data of the type of *ptr beginning at
27 ptr to the named output stream. It returns the number of items actu‐
28 ally written.
29
31 read(2), write(2), fopen(3S), getc(3S), putc(3S), gets(3S), puts(3S),
32 printf(3S), scanf(3S)
33
35 Fread and fwrite return 0 upon end of file or error.
36
37
38
394th Berkeley Distribution May 15, 1985 FREAD(3S)