Seek (statement)

<< Click to Display Table of Contents >>

Seek (statement)

Seek [#]FileNumber, Position

Sets the file pointer to a new position in a file. This command works only on open files.

FileNumber is a number assigned to a file by Open statement.

Position is the position within the file from which the next read or write operation should start (as offset in bytes from the beginning of the file).

See also: Open

Example:

Sub Main

 Open "TESTFILE" For Input As #1   ' Open file

 For i = 0 To 24 Step 3

         Seek #1, i                    ' Set file pointer

         MyChar = Input(1, #1)         ' Read character

         Print MyChar                  ' Output character

 Next i

 Close #1                          ' Close file

End Sub