| Line | |
|---|
| 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 | .\"
|
|---|
| 5 | .\" @(#)fread.3s 6.1 (Berkeley) 5/15/85
|
|---|
| 6 | .\"
|
|---|
| 7 | .TH FREAD 3 "May 15, 1985"
|
|---|
| 8 | .UC 4
|
|---|
| 9 | .SH NAME
|
|---|
| 10 | fread, fwrite \- buffered binary input/output
|
|---|
| 11 | .SH SYNOPSIS
|
|---|
| 12 | .nf
|
|---|
| 13 | .ft B
|
|---|
| 14 | #include <sys/types.h>
|
|---|
| 15 | #include <stdio.h>
|
|---|
| 16 |
|
|---|
| 17 | size_t fread(void *\fIptr\fP, size_t \fIitemsize\fP, size_t \fInitems\fP, FILE *\fIstream\fP)
|
|---|
| 18 | size_t fwrite(void *\fIptr\fP, size_t \fIitemsize\fP, size_t \fInitems\fP, FILE *\fIstream\fP)
|
|---|
| 19 | .SH DESCRIPTION
|
|---|
| 20 | .B Fread
|
|---|
| 21 | reads, into a block beginning at
|
|---|
| 22 | .IR ptr ,
|
|---|
| 23 | .I nitems
|
|---|
| 24 | of data of the type of
|
|---|
| 25 | .I *ptr
|
|---|
| 26 | from the named input
|
|---|
| 27 | .IR stream .
|
|---|
| 28 | It returns the number of items actually read.
|
|---|
| 29 | .PP
|
|---|
| 30 | If
|
|---|
| 31 | .I stream
|
|---|
| 32 | is
|
|---|
| 33 | .B stdin
|
|---|
| 34 | and the standard output is line buffered, then any partial output line
|
|---|
| 35 | will be flushed before any call to
|
|---|
| 36 | .BR read (2)
|
|---|
| 37 | to satisfy the
|
|---|
| 38 | .BR fread .
|
|---|
| 39 | .PP
|
|---|
| 40 | .B Fwrite
|
|---|
| 41 | appends at most
|
|---|
| 42 | .I nitems
|
|---|
| 43 | of data of the type of
|
|---|
| 44 | .I *ptr
|
|---|
| 45 | beginning at
|
|---|
| 46 | .I ptr
|
|---|
| 47 | to the named output
|
|---|
| 48 | .IR stream .
|
|---|
| 49 | It returns the number of items actually written.
|
|---|
| 50 | .SH "SEE ALSO"
|
|---|
| 51 | .BR read (2),
|
|---|
| 52 | .BR write (2),
|
|---|
| 53 | .BR fopen (3),
|
|---|
| 54 | .BR getc (3),
|
|---|
| 55 | .BR putc (3),
|
|---|
| 56 | .BR gets (3),
|
|---|
| 57 | .BR puts (3),
|
|---|
| 58 | .BR printf (3),
|
|---|
| 59 | .BR scanf (3).
|
|---|
| 60 | .SH DIAGNOSTICS
|
|---|
| 61 | .B Fread
|
|---|
| 62 | and
|
|---|
| 63 | .B fwrite
|
|---|
| 64 | return
|
|---|
| 65 | 0
|
|---|
| 66 | upon end of file or error.
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.