NAME

fseek - change the current read/write position in a File

SYNOPSIS

file.fseek(offs, whence)

DESCRIPTION

The fseek() intrinsic method sets the current read/write position in a file. The new position is obtained by adding offs bytes to the position specified by whence:

whence Meaning
io::SEEK_SET Relative to beginning of file
io::SEEK_CUR Relative to current read/write position
io::SEEK_END Relative to end-of-file

offs may be an Int or a Long. The current read/write position may be obtained with the ftell() intrinsic method. A successful fseek() will clear the end-of-file indicator and remove any effect of ungetc().

Because they may contain variable-length multibyte UTF-8 sequences, text-mode files may only fseek() to a well-defined position - either the beginning or end of file, or an absolute position previously returned by ftell().

RETURN VALUE

None

ERRORS

ArgCheck if an incorrect number of arguments are specified
TypeCheck if file is not a File, offs is not an Int or Long, or whence is not an Int
RangeCheck if whence is not one of io::SEEK_SET, io::SEEK_CUR, or io::SEEK_END
AccessCheck if file has been closed
IoCheck for general I/O subsystem errors

EXAMPLE

    file.fseek(0, io::SEEK_END); // Go to the end-of-file

SEE ALSO

ftell
rewind
feof
ispipe
ungetc