Table of Contents

READ#

The READ# command is used for restoring the contents of a variable from a file. The file must be opened first using OPEN.

Syntax

READ #<logical_file_no>, <variable> [, <variable> ... ]

The READ# command is similar to INPUT# in that both commands read sequential data from a file, however while INPUT# accepts PETSCII-encoded (textual) data, READ# accepts binary data. To put it simple:

  • INPUT# can restore data stored using PRINT#
  • READ# can restore data stored using WRITE#

Note

READ accepts any number of variables of any type, even User-Defined Types.

For an in-depth explanation of file input-output operations with examples, please read File I/O.

See also