Difference between revisions of "GET"

From QB64 Wiki
Jump to navigation Jump to search
Line 27: Line 27:
''See also:'' [[PUT]], [[SEEK]], [[SEEK (statement)]], [[INPUT (file statement)|INPUT #]]
''See also:'' [[PUT|PUT #]], [[SEEK]], [[SEEK (statement)]], [[INPUT (file statement)|INPUT #]]

Revision as of 16:05, 12 October 2009

The GET # file or port statement reads data from a by bytes or record positions.

Syntax: GET #filenumber%, [location], variable_value

  • File/port number is the number used in the OPEN AS statement.
  • The byte or record location is the byte in a BINARY file or the record in a RANDOM file.
  • Location can be omitted if the GETs are consecutive or when creating a new file.
  • The variable value is any string or number type or a TYPE or FIELD variable.

Example: Using a TYPE record variable to read a record.

OPEN file$ FOR RANDOM as #1 LEN = LEN(Contact)
IF record% <= LOF(1) \ LEN(Contact) THEN GET #1, record%, Contact

Note: The Contact record contains all of the DOT variable types listed in the TYPE.

See also: PUT #, SEEK, SEEK (statement), INPUT #


Go to Keyword Reference - Alphabetical

Go to Keyword Reference - By usage