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 Fwrite appends at most nitems of data of the type of *ptr beginning at
23 ptr to the named output stream. It returns the number of items actu‐
24 ally written.
25
27 read(2), write(2), fopen(3), getc(3), putc(3), gets(3), puts(3),
28 printf(3), scanf(3)
29
31 Fread and fwrite return 0 upon end of file or error.
32
33
34
35 FREAD(3S)