WRITE#
VIC-20 C16 Plus/4 C64 C128 M65
The WRITE#
command is used for saving the contents of a variable to a file. The file must be opened first using OPEN.
WRITE #<logical_file_no>, <expression> [, <exrpession>, ... ]
The WRITE#
command is similar to PRINT# in that both commands output sequential data to a file. However, while PRINT#
outputs PETSCII-encoded (textual) data, WRITE#
outputs binary data. To illustrate:
PRINT#
is used to store data that can be restored using INPUT#WRITE#
is used to store data that can be restored using READ#
Warning
The WRITE#
command accepts any number of arguments of any type. As data will be output in a raw binary form, without separators, it is very important to make sure that each datum is in the exact same type and order that will be used when reading.
For an in-depth explanation of file input-output operations with examples, please refer to File I/O.
Warning
File I/O commands are not implemented for the Commodore PET.