Difference between revisions of "SEEK (statement)"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
m
imported>Clippy
m
Line 8: Line 8:


* The filenumber must be a file that is [[OPEN]].
* The filenumber must be a file that is [[OPEN]].
* Position is a byte in [[BINARY]] or sequencial files created in [[OUTPUT]], [[APPEND]] or [[INPUT (file mode)]]s.
* Position is a byte in [[BINARY]] or sequencial files created in [[OUTPUT]], [[APPEND]] or [[INPUT (file mode)]]s. The first byte = 1.
* Position is the record in [[RANDOM]] files to read or write.
* Position is the record in [[RANDOM]] files to read or write.
* After a SEEK statement, the next file operation starts at that SEEK byte position.
* The SEEK statement can work with the [[SEEK]] function to move around in a file.
* The SEEK statement can work with the [[SEEK]] function to move around in a file.



Revision as of 18:38, 13 September 2010

The SEEK statement sets the next byte or record position of a file for a read or write.


Syntax: SEEK filenumber%, position%


  • The filenumber must be a file that is OPEN.
  • Position is a byte in BINARY or sequencial files created in OUTPUT, APPEND or INPUT (file mode)s. The first byte = 1.
  • Position is the record in RANDOM files to read or write.
  • After a SEEK statement, the next file operation starts at that SEEK byte position.
  • The SEEK statement can work with the SEEK function to move around in a file.


Example: A SEEK statement using the SEEK function to move to the next random record in a file.

SEEK 1, SEEK(1) + 1


See also:




Navigation:
Keyword Reference - Alphabetical
Keyword Reference - By Usage
Main Wiki Page