bas7advr.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
SEEK Statement Details
  ◄Syntax►  ◄Details►  ◄Example►                 ◄Contents►  ◄Index►  ◄Back►
──────────────────────────────────────────────────────────────────────────────
SEEK sets the position in a file for the next read or write.
 
SEEK [#]filenumber%, position&
    ■ The argument filenumber% is an integer used in the OPEN statement
      to open the file.
    ■ 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 specified byte position.
 
Important
    ■ Record numbers on a GET or PUT override the file positioning
      done by SEEK.
 
Usage Notes
    ■ If you attempt a SEEK operation to a negative or zero position, BASIC
      generates the error message, "Bad record number." Performing a file
      write after doing a SEEK beyond the end of a file extends the file.
    ■ BASIC leaves the file position unchanged when you use SEEK on an
      ISAM table or on BASIC devices (SCRN, CONS, KYBD, COMn, LPTn,
      PIPE) that do not support SEEK.