| Write # Statement |
Named Arguments
No
Syntax
Write #filenumber, [outputlist]
filenumber
Use: Required
Data Type: Integer
Any valid file number.
outputlist
Use: Optional
A comma-delimited list of expressions to be written to the file.
Description
Writes structured data to a sequential file.
Rules at a Glance
outputlist can contain multiple expressions delimited with either a comma, a semicolon, or a space.
Calling the Write # statement with a single comma in place of outputlist forces a blank line to be written to the file.
Object data can't be written to a file opened with the Open statement.
The following table describes how the Write # statement handles certain types of data, regardless of the locale, to allow files to be read universally:
Data Type Data Written to File Numeric Decimal separator is always a period (.) Boolean #TRUE# or #FALSE# Date #yyyy-mm-dd hh:mm:ss# (Hours specified in 24-hour format) Null #NULL# Error #ERROR errorcode# The Write statement automatically does the following:
Delimits data fields with a comma.
Places quotation marks around string data.
Inserts a newline character (Chr(13) + Chr(10)) after the last item in outputlist is written to the file.
Programming Tips and Gotchas
The structured data written to a file using the Write # statement is most suited to being read back from the file using the Input # statement.
See Also
- Input # Statement, Print # Statement
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access