.TH FSEEK 3S .CT 2 file_io .SH NAME fseek, ftell, rewind \(mi reposition a stream .SH SYNOPSIS .nf .B #include .PP .B int fseek(stream, offset, ptrname) .B FILE *stream; .B long offset; .PP .B long ftell(stream) .B FILE *stream; .PP .B int rewind(stream) .fi .SH DESCRIPTION .I Fseek sets the position of the next input or output operation on the .IR stream . The new position is at the signed distance .I offset bytes from the beginning, the current position, or the end of the file, as .I ptrname has the value 0, 1 or 2 respectively. .PP .I Ftell returns the current value of the file pointer for the file associated with the named .IR stream . .PP .IR Rewind ( stream ) is equivalent to .BR "fseek(stream, 0L, 0)" . .SH "SEE ALSO" .IR lseek (2), .IR stdio (3) .SH DIAGNOSTICS .I Fseek returns \-1 for improper seeks. .SH BUGS The interaction of .I fseek and .IR ungetc (3) is undefined.