1 .\" Copyright (c) 1990, 1991 The Regents of the University of California.
2 .\" All rights reserved.
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.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in the
15 .\" documentation and/or other materials provided with the distribution.
16 .\" 3. All advertising materials mentioning features or use of this software
17 .\" must display the following acknowledgement:
18 .\" This product includes software developed by the University of
19 .\" California, Berkeley and its contributors.
20 .\" 4. Neither the name of the University nor the names of its contributors
21 .\" may be used to endorse or promote products derived from this software
22 .\" without specific prior written permission.
24 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 .\" @(#)fseek.3 6.11 (Berkeley) 6/29/91
38 .\" Converted for Linux, Mon Nov 29 15:22:01 1993, faith@cs.unc.edu
41 .\" Japanese Version Copyright (c) 1998 NAKANO Takeo all rights reserved.
42 .\" Translated Mon Apr 27 1998 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
44 .\" WORD: file position indicator ファイル位置表示子
45 .\" WORD: error indicator エラー表示子
47 .TH FSEEK 3 1993-11-29 "GNU" "Linux Programmer's Manual"
49 .\"O fgetpos, fseek, fsetpos, ftell, rewind \- reposition a stream
51 fgetpos, fseek, fsetpos, ftell, rewind \- ストリームの位置を変更する
56 .BI "int fseek(FILE *" stream ", long " offset ", int " whence );
58 .BI "long ftell(FILE *" stream );
60 .BI "void rewind(FILE *" stream );
62 .BI "int fgetpos(FILE *" stream ", fpos_t *" pos );
64 .BI "int fsetpos(FILE *" stream ", fpos_t *" pos );
69 .\"O function sets the file position indicator for the stream pointed to by
71 .\"O The new position, measured in bytes, is obtained by adding
73 .\"O bytes to the position specified by
78 によって指定されたストリームにおいて、ファイル位置表示子
79 (file position indicator) をセットする。新たな位置 (バイト単位)
92 .\"O the offset is relative to the start of the file, the current position
93 .\"O indicator, or end-of-file, respectively.
94 .\"O A successful call to the
96 .\"O function clears the end-of-file indicator for the stream and undoes
97 .\"O any effects of the
99 .\"O function on the same stream.
105 のどれかになっている場合は、それぞれファイルの先頭、現在の位置表示子、
106 ファイルの末尾からのオフセットが取られる。
108 関数の呼び出しが成功すると、ストリームの end-of-file 表示子は
115 .\"O function obtains the current value of the file position indicator for the
116 .\"O stream pointed to by
121 によって指定されたストリームにおける、ファイル位置表示子
126 .\"O function sets the file position indicator for the stream pointed to by
128 .\"O to the beginning of the file.
129 .\"O It is equivalent to:
133 によって指定されたストリームにおいて、ファイル位置表示子
134 をファイルの先頭にセットする。この関数は以下と等価である。
137 (void) fseek(stream, 0L, SEEK_SET)
140 .\"O except that the error indicator for the stream is also cleared (see
141 .\"O .BR clearerr (3)).
144 ではストリームに対するエラー表示子 (error indicator) も同時に
153 .\"O functions are alternate interfaces equivalent to
157 .\"O (with whence set to
159 .\"O setting and storing the current value of the file offset into or from the
160 .\"O object referenced by
173 を指定した場合と同様の機能を、異なるインターフェースで提供する。
182 .\"O On some non-UNIX systems an
184 .\"O object may be a complex object and these routines may be the only way to
185 .\"O portably reposition a text stream.
188 が構造体などの複雑なオブジェクトになっていて、これらのルーチンがテキス
189 トストリームでファイル位置を変更する方法のうち、移植性のある唯一のもの
191 .\"O .SH "RETURN VALUES"
195 .\"O function returns no value.
196 .\"O Upon successful completion,
203 .\"O returns the current offset.
204 .\"O Otherwise, \-1 is returned and
206 .\"O is set to indicate the error.
214 は現在のオフセットを返す。失敗した場合は返り値は \-1 となり、
223 .\"O specified is not a seekable stream.
253 .\"O may also fail and set
255 .\"O for any of the errors specified for the routines
270 などのルーチンを呼び出す際に失敗する可能性がある。この場合は
282 .\"O functions conform to ANSI C3.159-1989 (``ANSI C'').