
SEEK moves the file pointer of an open file to the specified position. SEEK needs two arguments. The first one is the file handle and the second one is the new file pointer position. When an offset above the file size is specified in write mode, the file size is extended to the offset and the data in the extended area is undefined. This is suitable to create a large file quickly, for fast write operations without cluster allocation delay.
This example opens a file named "test.txt" for reading. It then moves the file pointer 3 bytes ahead and reads some bytes beginning at the fourth byte of the file.
outmode -2 open "R", 1, "test.txt" if LASTERR = 0 then seek 1, 3 get 1, a$ print a$ close 1 else print "could not open!" end if
Because the second argument is a 32 bit signed integer, the furthermost position that can be reached with SEEK is at 2,147,483,647