OSDN Git Service

(split) LDP: Update the version to 3.53 in PO files
[linuxjm/LDP_man-pages.git] / draft / man3 / fseek.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 .\"     @(#)fseek.3     6.11 (Berkeley) 6/29/91
39 .\"
40 .\" Converted for Linux, Mon Nov 29 15:22:01 1993, faith@cs.unc.edu
41 .\"
42 .\"*******************************************************************
43 .\"
44 .\" This file was generated with po4a. Translate the source file.
45 .\"
46 .\"*******************************************************************
47 .TH FSEEK 3 1993\-11\-29 GNU "Linux Programmer's Manual"
48 .SH 名前
49 fgetpos, fseek, fsetpos, ftell, rewind \- ストリームの位置を変更する
50 .SH 書式
51 \fB#include <stdio.h>\fP
52 .sp
53 \fBint fseek(FILE *\fP\fIstream\fP\fB, long \fP\fIoffset\fP\fB, int \fP\fIwhence\fP\fB);\fP
54
55 \fBlong ftell(FILE *\fP\fIstream\fP\fB);\fP
56
57 \fBvoid rewind(FILE *\fP\fIstream\fP\fB);\fP
58
59 \fBint fgetpos(FILE *\fP\fIstream\fP\fB, fpos_t *\fP\fIpos\fP\fB);\fP
60 .br
61 \fBint fsetpos(FILE *\fP\fIstream\fP\fB, fpos_t *\fP\fIpos\fP\fB);\fP
62 .SH 説明
63 \fBfseek\fP()  関数は \fIstream\fP によって指定されたストリームにおいて、ファイル位置表示子 (file position
64 indicator) をセットする。新たな位置 (バイト単位)  は \fIwhence\fP で指定された位置に \fIoffset\fP
65 バイトを加えることによって与えられる。 \fIwhence\fP が \fBSEEK_SET\fP, \fBSEEK_CUR\fP, \fBSEEK_END\fP
66 のどれかになっている場合は、それぞれファイルの先頭、現在の位置表示子、 ファイルの末尾からのオフセットが取られる。 \fBfseek\fP()
67 関数の呼び出しが成功すると、ストリームの end\-of\-file 表示子は クリアされ、それまでに \fBungetc\fP(3)
68 関数で戻したデータはなかったことになる。
69 .PP
70 \fBftell\fP()  関数は \fIstream\fP によって指定されたストリームにおける、ファイル位置表示子 の現時点での値を与える。
71 .PP
72 \fBrewind\fP()  関数は \fIstream\fP によって指定されたストリームにおいて、ファイル位置表示子
73 をファイルの先頭にセットする。この関数は以下と等価である。
74 .PP
75 .RS
76 (void) fseek(stream, 0L, SEEK_SET)
77 .RE
78 .PP
79 ただし \fBrewind\fP()  ではストリームに対するエラー表示子 (error indicator) も同時に クリアされる (
80 \fBclearerr\fP(3)  を見よ)。
81 .PP
82 \fBfgetpos\fP()  関数と \fBfsetpos\fP()  関数は、それぞれ \fBftell\fP()  と \fBfseek\fP()  で
83 \fIwhence\fP に \fBSEEK_SET\fP を指定した場合と同様の機能を、異なるインターフェースで提供する。 \fBfgetpos\fP()
84 はファイルオフセットの現在の値を \fIpos\fP が参照するオブジェクトに保存し、 \fBfsetpos\fP()  はファイルオフセットを \fIpos\fP
85 に設定する。 UNIX 以外のシステムにおいては、 \fIfpos_t\fP が構造体などの複雑なオブジェクトになっていて、これらのルーチンがテキス
86 トストリームでファイル位置を変更する方法のうち、移植性のある唯一のもの になっている場合もある。
87 .SH 返り値
88 \fBrewind\fP()  は返り値を持たない。 \fBfgetpos\fP(), \fBfseek\fP(), \fBfsetpos\fP()  は成功すると 0
89 を返す。 \fBftell\fP()  は現在のオフセットを返す。失敗した場合は返り値は \-1 となり、 \fIerrno\fP にエラーを示す値がセットされる。
90 .SH エラー
91 .TP 
92 \fBEBADF\fP
93 指定した \fIstream\fP がシークできない。
94 .TP 
95 \fBEINVAL\fP
96 \fBfseek\fP()  関数に対して与えた \fIwhence\fP 引数が \fBSEEK_SET\fP, \fBSEEK_END\fP, \fBSEEK_CUR\fP
97 以外の値であった。
98 .PP
99 \fBfgetpos\fP(), \fBfseek\fP(), \fBfsetpos\fP(), \fBftell\fP()  は、それぞれ \fBfflush\fP(3),
100 \fBfstat\fP(2), \fBlseek\fP(2), \fBmalloc\fP(3)  などのルーチンを呼び出す際に失敗する可能性がある。この場合は
101 それぞれ対応した \fIerrno\fP が設定される。
102 .SH 準拠
103 C89, C99.
104 .SH 関連項目
105 \fBlseek\fP(2), \fBfseeko\fP(3)
106 .SH この文書について
107 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
108 である。プロジェクトの説明とバグ報告に関する情報は
109 http://www.kernel.org/doc/man\-pages/ に書かれている。