Commit | Line | Data |
---|---|---|
74188ac6 KM |
1 | .\" Copyright (c) 1980 Regents of the University of California. |
2 | .\" All rights reserved. The Berkeley software License Agreement | |
3 | .\" specifies the terms and conditions for redistribution. | |
4 | .\" | |
0c0fbab6 | 5 | .\" @(#)fread.3 6.1 (Berkeley) %G% |
74188ac6 | 6 | .\" |
0c0fbab6 | 7 | .TH FREAD 3S "" |
74188ac6 KM |
8 | .UC 4 |
9 | .SH NAME | |
10 | fread, fwrite \- buffered binary input/output | |
11 | .SH SYNOPSIS | |
12 | .B #include <stdio.h> | |
13 | .PP | |
14 | .B fread(ptr, sizeof(*ptr), nitems, stream) | |
15 | .br | |
16 | .SM | |
17 | .B FILE | |
18 | .B *stream; | |
19 | .PP | |
20 | .B fwrite(ptr, sizeof(*ptr), nitems, stream) | |
21 | .br | |
22 | .SM | |
23 | .B FILE | |
24 | .B *stream; | |
25 | .SH DESCRIPTION | |
26 | .I Fread | |
27 | reads, into a block beginning at | |
5264ba00 | 28 | .IR ptr , |
74188ac6 KM |
29 | .I nitems |
30 | of data of the type of | |
31 | .I *ptr | |
32 | from the named input | |
33 | .IR stream . | |
34 | It returns the number of items actually read. | |
35 | .PP | |
36 | If | |
37 | .I stream | |
38 | is | |
39 | .B stdin | |
40 | and the standard output is line buffered, then any partial output line | |
41 | will be flushed before any call to | |
42 | .IR read (2) | |
43 | to satisfy the | |
5264ba00 | 44 | .IR fread . |
74188ac6 KM |
45 | .PP |
46 | .I Fwrite | |
47 | appends at most | |
48 | .I nitems | |
49 | of data of the type of | |
50 | .I *ptr | |
51 | beginning at | |
52 | .I ptr | |
53 | to the named output | |
54 | .IR stream . | |
55 | It returns the number of items actually written. | |
56 | .SH "SEE ALSO" | |
5264ba00 KM |
57 | read(2), |
58 | write(2), | |
59 | fopen(3S), | |
60 | getc(3S), | |
61 | putc(3S), | |
62 | gets(3S), | |
63 | puts(3S), | |
64 | printf(3S), | |
65 | scanf(3S) | |
74188ac6 KM |
66 | .SH DIAGNOSTICS |
67 | .I Fread | |
68 | and | |
69 | .I fwrite | |
70 | return | |
71 | 0 | |
72 | upon end of file or error. |