Start Back Next End
  
ZBasic System Library
ZBasic Microcontrollers
19
File.Seek
Type
Function returning Long
Invocation
File.Seek(handle, offset, origin)
Parameter
Method
Type
Description
handle
ByVal
integral
The handle of the file to read, previously returned by File.Open().
offset
ByVal
integral
The signedoffset to which to seek, relative to the origin parameter.
origin
ByVal
integral
The origin for the seek (see discussion).
Discussion
This function repositions the file in preparation for subsequent read/write operations.  The offset
parameter is treated as a signed value allowing seeks to positions before or after the origin position which
is specified as one of the values in the table below.
Origin Designators for Seek Operation
Value
Meaning
0
The new position is relative the the beginning of the file.
1
The new position is relative to the current position.
2
The new position is relative to the end of the file.
Note that negative offsets don't make sense when the origin is the beginning of the file nor do offsets
greater than zero when the origin is the end of the file.  The value returned is negative if an error occurs,
otherwise, the value returned is the new file position.  Invoking File.Seek with a position of zero and an
origin value of 1 results in the current position being returned.  Invoking File.Seek with a position of
zero and an origin value of 2 returns the current file size (but see File.Size).
Previous page Top Next page