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 Function Details
  ◄Syntax►  ◄Details►  ◄Example►                 ◄Contents►  ◄Index►  ◄Back►
──────────────────────────────────────────────────────────────────────────────
SEEK returns the current file position.
 
SEEK(filenumber&)
 
Usage Notes
    ■ 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 BASIC devices
      (SCRN, CONS, KYBD, COMn, LPTn, PIPE) that do not support SEEK.
 
Programming Tips
    ■ The following code fragment 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."
           CASE ELSE
        END SELECT