OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / release / 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 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
10 .\" are met:
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.
23 .\"
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
34 .\" SUCH DAMAGE.
35 .\"
36 .\"     @(#)fseek.3     6.11 (Berkeley) 6/29/91
37 .\"
38 .\" Converted for Linux, Mon Nov 29 15:22:01 1993, faith@cs.unc.edu
39 .\"
40 .\"
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>
43 .\"
44 .\" WORD:       file position indicator ¥Õ¥¡¥¤¥ë°ÌÃÖɽ¼¨»Ò
45 .\" WORD:       error indicator         ¥¨¥é¡¼É½¼¨»Ò
46 .\"
47 .TH FSEEK 3  1993-11-29 "GNU" "Linux Programmer's Manual"
48 .SH Ì¾Á°
49 fgetpos, fseek, fsetpos, ftell, rewind \- ¥¹¥È¥ê¡¼¥à¤Î°ÌÃÖ¤òÊѹ¹¤¹¤ë
50 .SH ½ñ¼°
51 .B #include <stdio.h>
52 .sp
53 .BI "int fseek(FILE *" stream ", long " offset ", int " whence );
54
55 .BI "long ftell(FILE *" stream );
56
57 .BI "void rewind(FILE *" stream );
58
59 .BI "int fgetpos(FILE *" stream ", fpos_t *" pos );
60 .br
61 .BI "int fsetpos(FILE *" stream ", fpos_t *" pos );
62 .SH ÀâÌÀ
63 .BR fseek ()
64 ´Ø¿ô¤Ï
65 .I stream
66 ¤Ë¤è¤Ã¤Æ»ØÄꤵ¤ì¤¿¥¹¥È¥ê¡¼¥à¤Ë¤ª¤¤¤Æ¡¢¥Õ¥¡¥¤¥ë°ÌÃÖɽ¼¨»Ò
67 (file position indicator) ¤ò¥»¥Ã¥È¤¹¤ë¡£¿·¤¿¤Ê°ÌÃÖ (¥Ð¥¤¥Èñ°Ì)
68 ¤Ï
69 .I whence
70 ¤Ç»ØÄꤵ¤ì¤¿°ÌÃÖ¤Ë
71 .I offset
72 ¥Ð¥¤¥È¤ò²Ã¤¨¤ë¤³¤È¤Ë¤è¤Ã¤ÆÍ¿¤¨¤é¤ì¤ë¡£
73 .I whence
74 ¤¬
75 .BR SEEK_SET ,
76 .BR SEEK_CUR ,
77 .B SEEK_END
78 ¤Î¤É¤ì¤«¤Ë¤Ê¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢¤½¤ì¤¾¤ì¥Õ¥¡¥¤¥ë¤ÎÀèƬ¡¢¸½ºß¤Î°ÌÃÖɽ¼¨»Ò¡¢
79 ¥Õ¥¡¥¤¥ë¤ÎËöÈø¤«¤é¤Î¥ª¥Õ¥»¥Ã¥È¤¬¼è¤é¤ì¤ë¡£
80 .BR fseek ()
81 ´Ø¿ô¤Î¸Æ¤Ó½Ð¤·¤¬À®¸ù¤¹¤ë¤È¡¢¥¹¥È¥ê¡¼¥à¤Î end-of-file É½¼¨»Ò¤Ï
82 ¥¯¥ê¥¢¤µ¤ì¡¢¤½¤ì¤Þ¤Ç¤Ë
83 .BR ungetc (3)
84 ´Ø¿ô¤ÇÌᤷ¤¿¥Ç¡¼¥¿¤Ï¤Ê¤«¤Ã¤¿¤³¤È¤Ë¤Ê¤ë¡£
85 .PP
86 .BR ftell ()
87 ´Ø¿ô¤Ï
88 .I stream
89 ¤Ë¤è¤Ã¤Æ»ØÄꤵ¤ì¤¿¥¹¥È¥ê¡¼¥à¤Ë¤ª¤±¤ë¡¢¥Õ¥¡¥¤¥ë°ÌÃÖɽ¼¨»Ò
90 ¤Î¸½»þÅÀ¤Ç¤ÎÃͤòÍ¿¤¨¤ë¡£
91 .PP
92 .BR rewind ()
93 ´Ø¿ô¤Ï
94 .I stream
95 ¤Ë¤è¤Ã¤Æ»ØÄꤵ¤ì¤¿¥¹¥È¥ê¡¼¥à¤Ë¤ª¤¤¤Æ¡¢¥Õ¥¡¥¤¥ë°ÌÃÖɽ¼¨»Ò
96 ¤ò¥Õ¥¡¥¤¥ë¤ÎÀèƬ¤Ë¥»¥Ã¥È¤¹¤ë¡£¤³¤Î´Ø¿ô¤Ï°Ê²¼¤ÈÅù²Á¤Ç¤¢¤ë¡£
97 .PP
98 .RS
99 (void) fseek(stream, 0L, SEEK_SET)
100 .RE
101 .PP
102 ¤¿¤À¤·
103 .BR rewind ()
104 ¤Ç¤Ï¥¹¥È¥ê¡¼¥à¤ËÂФ¹¤ë¥¨¥é¡¼É½¼¨»Ò (error indicator) ¤âƱ»þ¤Ë
105 ¥¯¥ê¥¢¤µ¤ì¤ë (
106 .BR clearerr (3)
107 ¤ò¸«¤è)¡£
108 .PP
109 .BR fgetpos ()
110 ´Ø¿ô¤È
111 .BR fsetpos ()
112 ´Ø¿ô¤Ï¡¢¤½¤ì¤¾¤ì
113 .BR ftell ()
114 ¤È
115 .BR fseek ()
116 ¤Ç
117 .I whence
118 ¤Ë
119 .B SEEK_SET
120 ¤ò»ØÄꤷ¤¿¾ì¹ç¤ÈƱÍͤε¡Ç½¤ò¡¢°Û¤Ê¤ë¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤ÇÄ󶡤¹¤ë¡£
121 .BR fgetpos ()
122 ¤Ï¥Õ¥¡¥¤¥ë¥ª¥Õ¥»¥Ã¥È¤Î¸½ºß¤ÎÃͤò
123 .I pos
124 ¤¬»²¾È¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤ËÊݸ¤·¡¢
125 .BR fsetpos ()
126 ¤Ï¥Õ¥¡¥¤¥ë¥ª¥Õ¥»¥Ã¥È¤ò
127 .I pos
128 ¤ËÀßÄꤹ¤ë¡£
129 Unix °Ê³°¤Î¥·¥¹¥Æ¥à¤Ë¤ª¤¤¤Æ¤Ï¡¢
130 .I fpos_t
131 ¤¬¹½Â¤ÂΤʤɤÎÊ£»¨¤Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ë¤Ê¤Ã¤Æ¤¤¤Æ¡¢¤³¤ì¤é¤Î¥ë¡¼¥Á¥ó¤¬¥Æ¥­¥¹
132 ¥È¥¹¥È¥ê¡¼¥à¤Ç¥Õ¥¡¥¤¥ë°ÌÃÖ¤òÊѹ¹¤¹¤ëÊýË¡¤Î¤¦¤Á¡¢°Ü¿¢À­¤Î¤¢¤ëÍ£°ì¤Î¤â¤Î
133 ¤Ë¤Ê¤Ã¤Æ¤¤¤ë¾ì¹ç¤â¤¢¤ë¡£
134 .SH ÊÖ¤êÃÍ
135 .BR rewind ()
136 ¤ÏÊÖ¤êÃͤò»ý¤¿¤Ê¤¤¡£
137 .BR fgetpos (),
138 .BR fseek (),
139 .BR fsetpos ()
140 ¤ÏÀ®¸ù¤¹¤ë¤È 0 ¤òÊÖ¤¹¡£
141 .BR ftell ()
142 ¤Ï¸½ºß¤Î¥ª¥Õ¥»¥Ã¥È¤òÊÖ¤¹¡£¼ºÇÔ¤·¤¿¾ì¹ç¤ÏÊÖ¤êÃͤϠ\-1 ¤È¤Ê¤ê¡¢
143 .I errno
144 ¤Ë¥¨¥é¡¼¤ò¼¨¤¹Ãͤ¬¥»¥Ã¥È¤µ¤ì¤ë¡£
145 .SH ¥¨¥é¡¼
146 .TP
147 .B EBADF
148 »ØÄꤷ¤¿
149 .I stream
150 ¤¬¥·¡¼¥¯¤Ç¤­¤Ê¤¤¡£
151 .TP
152 .B EINVAL
153 .BR fseek ()
154 ´Ø¿ô¤ËÂФ·¤ÆÍ¿¤¨¤¿
155 .I whence
156 °ú¿ô¤¬
157 .BR SEEK_SET ,
158 .BR SEEK_END ,
159 .B SEEK_CUR
160 °Ê³°¤ÎÃͤǤ¢¤Ã¤¿¡£
161 .PP
162 .BR fgetpos (),
163 .BR fseek (),
164 .BR fsetpos (),
165 .BR ftell ()
166 ¤Ï¡¢¤½¤ì¤¾¤ì
167 .BR fflush (3),
168 .BR fstat (2),
169 .BR lseek (2),
170 .BR malloc (3)
171 ¤Ê¤É¤Î¥ë¡¼¥Á¥ó¤ò¸Æ¤Ó½Ð¤¹ºÝ¤Ë¼ºÇÔ¤¹¤ë²ÄǽÀ­¤¬¤¢¤ë¡£¤³¤Î¾ì¹ç¤Ï
172 ¤½¤ì¤¾¤ìÂбþ¤·¤¿
173 .I errno
174 ¤¬ÀßÄꤵ¤ì¤ë¡£
175 .SH ½àµò
176 C89, C99.
177 .SH ´ØÏ¢¹àÌÜ
178 .BR lseek (2),
179 .BR fseeko (3)