.\" Copyright (c) 1990, 1991 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 6.11 (Berkeley) 6/29/91 .\" .\" Converted for Linux, Mon Nov 29 15:22:01 1993, faith@cs.unc.edu .\" .TH FSEEK 3 "29 de novembro de 1993" "BSD MANPAGE" "Manual do Programador Linux" .SH NOME fgetpos, fseek, fsetpos, ftell, rewind \- reposiciona um fluxo .SH SINOPSE .B #include .sp .BI "int fseek( FILE *" stream ", long " offset ", int " whence ); .br .BI "long ftell( FILE *" stream ); .br .BI "void rewind( FILE *" stream ); .br .BI "int fgetpos( FILE *" stream ", fpos_t *" pos ); .br .BI "int fsetpos( FILE *" stream ", fpos_t *" pos ); .SH DESCRIÇÃO A função .B fseek seta o indicador de posição de arquivo do fluxo apontado por .IR stream . A nova posição, medida em bytes, é obtida pelo acréscimo de .I offset bytes à posição especificada por .IR whence . Se .I whence é setado para .BR SEEK_SET , .BR SEEK_CUR , ou .BR SEEK_END , o offset é relativo ao início do arquivo, ao indicador de posição corrente, ou ao fim de arquivo, respectivamente. Uma chamada bem-sucedida à função .B fseek limpa o indicador de fim de arquivo para o fluxo e desfaz qualquer efeito da função .BR ungetc (3) no mesmo fluxo. .PP A função .B ftell obtém o valor corrente do indicador de posição de arquivo do fluxo apontado por .IR stream . .PP A função .B rewind seta o indicador de posição de arquivo do fluxo apontado por .I stream para o início do arquivo. É equivalente a: .PP .RS (void)fseek(stream, 0L, SEEK_SET) .RE .PP exceto pelo fato de que o indicador de erro do fluxo também é limpo (veja .BR clearerr (3)). .PP As funções .B fgetpos e .B fsetpos são interfaces alternativas equivalentes a .B ftell e .B fseek (com whence setado para .BR SEEK_SET ), configurando e armazenando o valor corrente do offset do arquivo do objeto referenciado por .IR pos . Em alguns sistemas não-UNIX, um objeto .B fpos_t pode ser um objeto complexo e estas rotinas podem ser a única maneira portável de reposicionar um fluxo de texto. .SH "VALORES DE RETORNO" A função .B rewind não retorna valor. Em caso de término bem-sucedido, .BR fgetpos , .BR fseek , .B fsetpos retornam 0, e .B ftell retorna o offset corrente. Caso contrário, \-1 é retornado e a variável global errno é setada para indicar o erro. .SH ERROS .TP .B EBADF O .I fluxo especificado não é um fluxo vasculhável. .TP .B EINVAL O argumento .I whence de .B fseek não era .BR SEEK_SET , .BR SEEK_END , ou .BR SEEK_CUR . .PP As funções .BR fgetpos , .BR fseek , .BR fsetpos , e .B ftell também podem falhar e setar .I errno para qualquer um dos erros especificados para as rotinas .BR fflush (3), .BR fstat (2), .BR lseek (2), e .BR malloc (3). .SH "VEJA TAMBÉM" .BR lseek (2) .SH PADRÕES As funções .BR fgetpos , .BR fsetpos , .BR fseek , .BR ftell , e .BR rewind estão em conformidade com ANSI X3.159-1989 (``ANSI C''). .SH TRADUÇÃO PARA A LÍNGUA PORTUGUESA \&\fR\&\f(CWRUBENS DE JESUS NOGUEIRA (tradução)\fR \&\fR\&\f(CWXXXXXX XX XXXXX XXXXXXXX (revisão)\fR