.\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" This code is derived from software contributed to Berkeley by .\" Chris Torek and the American National Standards Committee X3, .\" on Information Processing Systems. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#) fseek. 3 8.1 (Berkeley) 6/4/93 .\" %FreeBSD: src/lib/libc/stdio/fseek. 3, v 1.5. 2.7 2001/12/14 18:33:57 ru Exp % .\" $FreeBSD: doc/ja_JP.eucJP/man/man3/fseek. 3, v 1.4 2002/05/18 07:12:54 horikawa Exp $ .\" .Dd March 5, 1999 .Dt FSEEK 3 .Os .Sh ¸íĪ .Nm fgetpos , .Nm fseek , .Nm fseeko , .Nm fsetpos , .Nm ftell , .Nm ftello , .Nm rewind .Nd ½ºÆ®¸²ÀÇ À§Ä¡ º¯°æ .Sh ÇÁ·Î±×·¥ ¶óÀ̺귯¸® .Lb libc .Sh ¼­½Ä .In stdio.h .Ft int .Fn fseek "FILE *stream" "long offset" "int whence" .Ft long .Fn ftell "FILE *stream" .Ft void .Fn rewind "FILE *stream" .Ft int .Fn fgetpos "FILE *stream" "fpos_t *pos" .Ft int .Fn fsetpos "FILE *stream" "const fpos_t *pos" .In sys/types.h .Ft int .Fn fseeko "FILE *stream" "off_t offset" "int whence" .Ft off_t .Fn ftello "FILE *stream" .Sh ÇØ¼³ .Fn fseek ÇÔ¼ö´Â, .Fa stream ÇÏÁö¸¸ °¡¸®Å°´Â ½ºÆ®¸²ÀÇ ÆÄÀÏ À§Ä¡ ÀεðÄÉÀÌÅÍ(indicator)¸¦ ¼³Á¤ÇÕ´Ï´Ù. »õ·Î¿î À§Ä¡´Â ¹ÙÀÌÆ® ´ÜÀ§·Î °èÃø µÇ¾î .Fa whence ±×¸®°í ÁöÁ¤µÈ À§Ä¡¿¡ .Fa offset ¹ÙÀÌÆ®¸¦ ´õÇÏ´Â °ÍÀ¸·Î ¾òÀ» ¼ö ÀÖ½À´Ï´Ù. .Fa whence ÇÏÁö¸¸ .Dv SEEK_SET , .Dv SEEK_CUR , .Dv SEEK_END (À¸)·Î ¼³Á¤µÇ¾î ÀÖ´Â °æ¿ì, ¿ÀÇÁ¼Â(offset)´Â, °¢°¢, ÆÄÀÏÀÇ ÃÖÃÊ, ÀεðÄÉÀÌÅÍ(indicator)ÀÇ ÇöÀç À§Ä¡, ÆÄÀÏÀÇ ÃÖÈķκÎÅÍÀÇ »ó´ë À§Ä¡°¡ µË´Ï´Ù. .Fn fseek ÇÔ¼öÀÇ È£Ãâ·Î ¹®Á¦°¡ ¹ß»ýÇÏÁö ¾Ê´Â °æ¿ì´Â, ½ºÆ®¸²ÀÇ end-of-file Áö½ÃÀÚ°¡ Ŭ¸®¾î µÇ¾î ±× ½ºÆ®¸²¿¡ ´ëÇÑ´Ù .Xr ungetc 3 ÇÔ¼öÀÇ È¿°ú´Â »èÁ¦µË´Ï´Ù. .Pp .Fn ftell ÇÔ¼ö´Â, .Fa stream ÇÏÁö¸¸ °¡¸®Å°´Â ½ºÆ®¸²ÀÇ ÆÄÀÏ À§Ä¡ ÀεðÄÉÀÌÅÍ(indicator)ÀÇ ÇöÀçÀÇ °ªÀ» ÀÔ¼öÇÕ´Ï´Ù. .Pp .Fn rewind ÇÔ¼ö´Â, .Fa stream ÇÏÁö¸¸ °¡¸®Å°´Â ½ºÆ®¸²ÀÇ ÆÄÀÏ À§Ä¡ ÀεðÄÉÀÌÅÍ(indicator)¸¦ ÆÄÀÏÀÇ ÃÖÃÊ·Î ¼³Á¤ÇÕ´Ï´Ù. À̰ÍÀº, ½ºÆ®¸²ÀÇ ¿¡·¯ ÀεðÄÉÀÌÅÍ(indicator)°¡ Ŭ¸®¾î µÇ´Â °Í ( .Xr clearerr 3 (À»)¸¦ ÂüÁ¶)¸¦ Á¦¿ÜÇϸé, ÀÌÇÏ¿Í °°Àº °á°ú°¡ µË´Ï´Ù. .Pp .Dl (void) fseek(stream, 0L, SEEK_SET) .Pp .Fn fseeko ÇÔ¼ö´Â .Fn fseek (¿Í)°ú °°½À´Ï´Ù¸¸, Àμö¿¡´Â .Fa long ´ë½Å¿¡ .Fa off_t (À»)¸¦ ÃëÇÕ´Ï´Ù. (¿Í)°ú °°ÀÌ .Fn ftello ÇÔ¼ö´Â .Fn ftell (¿Í)°ú °°½À´Ï´Ù¸¸, .Fa off_t (À»)¸¦ µ¹·ÁÁÝ´Ï´Ù. .Pp .Fn fgetpos ÇÔ¼ö¿Í .Fn fsetpos ÇÔ¼ö´Â, ( whence ¸¦ .Dv SEEK_SET (À¸)·Î ¼³Á¤Çß´Ù ) .Fn ftell (ÀÌ)³ª .Fn fseek (¿Í)°ú °°Àº ÀÎÅÍÆäÀ̽º·Î, ÆÄÀÏ ¿ÀÇÁ¼Â(offset)ÀÇ ÇöÀçÀÇ °ªÀ» .Fa pos ÇÏÁö¸¸ ÂüÁ¶ÇÏ´Â ¿ÀºêÁ§Æ®·ÎºÎÅÍ ¼³Á¤Çϰųª .Fa pos ÇÏÁö¸¸ ÂüÁ¶ÇÏ´Â ¿ÀºêÁ§Æ®¿¡ º¸Á¸Çϰųª ÇÕ´Ï´Ù. ÀϺÎÀÇ .Pq Tn UNIX ÀÌ¿ÜÀÇ ½Ã½ºÅÛ¿¡¼­´Â, .Dq Fa fpos_t ¿ÀºêÁ§Æ®°¡ º¹ÇÕ ¿ÀºêÁ§Æ®ÀÏÁöµµ ¸ð¸£±â ¶§¹®¿¡, À̽ļºÀ» À¯ÁöÇϸ鼭 ÅØ½ºÆ® ½ºÆ®¸²ÀÇ À§Ä¡¸¦ º¯°æÇϱâ À§Çؼ­´Â, ÀÌ routine¿¡ Àǹۿ¡ ¾ø´Â °Íµµ ÀÖ½À´Ï´Ù. .Sh ¹Ýȯ°ª .Fn rewind ÇÔ¼ö´Â °ªÀ» µ¹·ÁÁÖÁö ¾Ê½À´Ï´Ù. .Pp .Rv -std fgetpos fseek fseeko fsetpos .Pp ¼º°øÇØ Á¾·áÇϸé(ÀÚ), .Fn ftell ¹× .Fn ftello (Àº)´Â ÇöÀçÀÇ ¿ÀÇÁ¼Â(offset)¸¦ µ¹·ÁÁÝ´Ï´Ù. ±× ÀÌ¿ÜÀÇ °æ¿ì´Â \-1 ÀÌ µ¹·ÁÁÖ¾î ±Û·Î¹ú º¯¼ö .Va errno ÇÏÁö¸¸ ¼³Á¤µÇ¾î ¿¡·¯¸¦ ³ªÅ¸³À´Ï´Ù. .Sh ¿¡·¯ .Bl -tag -width Er .It Bq Er EBADF ÁöÁ¤µÇ¾ú´Ù .Fa stream ÇÏÁö¸¸, ½ÃÅ© ÇÒ ¼ö ÀÖ´Â ½ºÆ®¸²ÀÌ ¾Æ´Õ´Ï´Ù. .It Bq Er EINVAL .Fn fseek ÀÇ .Fa whence Àμö°¡, .Dv SEEK_SET , .Dv SEEK_END , .Dv SEEK_CUR ÀÇ ¾î¶² °ÍÀ̱⵵ ÇÏÁö ¾Ê½À´Ï´Ù. .It Bq Er EOVERFLOW .Fn ftell (À»)¸¦ ½ÇÇàÇÑ °á°úÀÇ ÆÄÀÏÀÇ ¿ÀÇÁ¼Â(offset)°¡ long ÇüÀÇ ¿ÀºêÁ§Æ®¿¡¼­´Â ¿Ã¹Ù¸£°Ô Ç¥ÇöÇÒ ¼ö ¾ø´Â °ªÀÌ µÇ¾ú½À´Ï´Ù. .El .Pp .Fn fgetpos , .Fn fseek , .Fn fseeko , .Fn fsetpos , .Fn ftell , .Fn ftello ÇÔ¼ö°¡ ½ÇÆÐÇßÀ» ¶§¿¡´Â, routine .Xr fflush 3 , .Xr fstat 2 , .Xr lseek 2 , .Xr malloc 3 ¿¡ ºÙ¾î °¡¸®Å°°í ÀÖ´Â ¿¡·¯°¡ .Va errno (À¸)·Î ¼³Á¤µÇ¾î ÀÖ´Â Àϵµ ÀÖ½À´Ï´Ù. .Sh °ü·Ã Ç׸ñ .Xr lseek 2 .Sh Ç¥ÁØ .Fn fgetpos , .Fn fsetpos , .Fn fseek , .Fn ftell , .Fn rewind ÇÔ¼ö´Â, .St -isoC ¿¡ ÀûÇÕÇϰí ÀÖ½À´Ï´Ù. .Pp .Fn fseeko (¿Í)°ú .Fn ftello ÇÔ¼ö´Â, .St -susv2 ¿¡ ÀûÇÕÇϰí ÀÖ½À´Ï´Ù. .\"X kuma 1999-11-6