advr.hlp (Topic list)
SEEK Function, SEEK Statement Details
  Summary  Details  Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
 SEEK(filenumber&)
 SEEK [#]filenumber%, position&
 
 Usage Notes (SEEK Function)
   ■ SEEK returns a value between 1 and 2,147,483,647, inclusive (equivalent
     to 2^31 -1).
 
   ■ When used on random-access files, SEEK returns the number of the next
     record read or written.
 
   ■ For files opened in binary, output, append, or input mode, SEEK
     returns the byte position in the file where the next operation is
     to take place. The first byte in a file is 1.
 
   ■ SEEK returns zero when used on an ISAM table or on Visual Basic devices
     (SCRN, CONS, KYBD, COMn, LPTn, PIPE) that do not support SEEK.
 
   ■ The following code prints a message indicating whether the last read
     or write was done in the first, second, or final third of the file:
 
         SELECT CASE (SEEK(1))
             CASE IS < .333*LOF(1)
                 PRINT "In first third of file."
             CASE .333*LOF(1) TO .667*LOF(1)
                 PRINT "In second third of file."
             CASE IS >= .667*LOF(1)
                 PRINT "In last third of file."
         END SELECT
 
 Usage Notes (SEEK Statement)
   ■ The argument filenumber% is an integer used in the OPEN statement to
     open the file. See: OPEN Statement
 
   ■ The argument position& is a numeric expression that indicates where
     the next read or write occurs. The position must be between 1 and
     2,147,483,647, inclusive (equivalent to 2^31 -1).
 
   ■ The first byte in a file is at position 1; the second byte is at
     position 2, and so on. After a SEEK, the next file I/O operation starts
     at the byte position specified by SEEK.
 
   ■ If you attempt a SEEK operation to a negative or zero position, Visual
     Basic generates the error message, "Bad record number." Performing a
     file write after doing a SEEK beyond end of file extends the file.
 
   ■ Visual Basic leaves the file position unchanged when you use SEEK on an
     ISAM table or on Visual Basic devices (SCRN, CONS, KYBD, COMn, LPTn,
     PIPE) that do not support SEEK.
 
   ■ Record numbers on a GET or PUT override the file positioning done by
     SEEK.