OSDN Git Service

dece930d382f32ff118f57ec4a9a4f70b877dce1
[linuxjm/LDP_man-pages.git] / release / man3 / fread.3
1 .\" Copyright (c) 1990, 1991 The Regents of the University of California.
2 .\" All rights reserved.
3 .\"
4 .\" This code is derived from software contributed to Berkeley by
5 .\" Chris Torek and the American National Standards Committee X3,
6 .\" on Information Processing Systems.
7 .\"
8 .\" %%%LICENSE_START(BSD_4_CLAUSE_UCB)
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
11 .\" are met:
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\"    notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\"    notice, this list of conditions and the following disclaimer in the
16 .\"    documentation and/or other materials provided with the distribution.
17 .\" 3. All advertising materials mentioning features or use of this software
18 .\"    must display the following acknowledgement:
19 .\"     This product includes software developed by the University of
20 .\"     California, Berkeley and its contributors.
21 .\" 4. Neither the name of the University nor the names of its contributors
22 .\"    may be used to endorse or promote products derived from this software
23 .\"    without specific prior written permission.
24 .\"
25 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 .\" SUCH DAMAGE.
36 .\" %%%LICENSE_END
37 .\"
38 .\"     @(#)fread.3     6.6 (Berkeley) 6/29/91
39 .\"
40 .\" Converted for Linux, Mon Nov 29 15:37:33 1993, faith@cs.unc.edu
41 .\" Sun Feb 19 21:26:54 1995 by faith, return values
42 .\" Modified Thu Apr 20 20:43:53 1995 by Jim Van Zandt <jrv@vanzandt.mv.com>
43 .\" Modified Fri May 17 10:21:51 1996 by Martin Schulze <joey@infodrom.north.de>
44 .\"
45 .\"*******************************************************************
46 .\"
47 .\" This file was generated with po4a. Translate the source file.
48 .\"
49 .\"*******************************************************************
50 .TH FREAD 3 2012\-03\-30 GNU "Linux Programmer's Manual"
51 .SH 名前
52 fread, fwrite \- バイナリストリームの入出力
53 .SH 書式
54 .nf
55 \fB#include <stdio.h>\fP
56 .sp
57 \fBsize_t fread(void *\fP\fIptr\fP\fB, size_t \fP\fIsize\fP\fB, size_t \fP\fInmemb\fP\fB, FILE *\fP\fIstream\fP\fB);\fP
58 .sp
59 \fBsize_t fwrite(const void *\fP\fIptr\fP\fB, size_t \fP\fIsize\fP\fB, size_t \fP\fInmemb\fP\fB,\fP
60 \fB              FILE *\fP\fIstream\fP\fB);\fP
61 .fi
62 .SH 説明
63 \fBfread\fP()  関数は \fIstream\fP ポインタで指定されたストリームから \fInmemb\fP 個のデータを読み込み、 \fIptr\fP
64 で与えられた場所に格納する。 個々のデータは \fIsize\fP バイトの長さを持つ。
65 .PP
66 \fBfwrite\fP()  関数は \fIptr\fP で指定された場所から得た \fInmemb\fP 個のデータを、 \fIstream\fP
67 ポインタで指定されたストリームに書き込む。 個々のデータは \fIsize\fP バイトの長さを持つ。
68 .PP
69 これらの処理を停止せずに行いたいときは、 \fBunlocked_stdio\fP(3)  を参照のこと。
70 .SH 返り値
71 成功すると、 \fBfread\fP() と \fBfwrite\fP() は読み書きを行った要素の個数を返す。
72 \fIsize\fP が 1 の場合は、この数字は転送されたバイト数と等しい。
73 エラーが生じた場合や、ファイルの末尾 (end\-of\-file) に達した場合、
74 返り値は指定した個数よりも小さい値 (または 0) となる。
75 .PP
76 \fBfread\fP()  は end\-of\-file とエラーを区別しないので、 どちらが生じたかを判断するためには、 呼び出し側で \fBfeof\fP(3)
77 と \fBferror\fP(3)  とを使用しなければならない。
78 .SH 準拠
79 C89, POSIX.1\-2001.
80 .SH 関連項目
81 \fBread\fP(2), \fBwrite\fP(2), \fBfeof\fP(3), \fBferror\fP(3), \fBunlocked_stdio\fP(3)
82 .SH この文書について
83 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.52 の一部
84 である。プロジェクトの説明とバグ報告に関する情報は
85 http://www.kernel.org/doc/man\-pages/ に書かれている。