Write # statement (LotusScript® Language)

Writes data to a sequential text file with delimiting characters.


Write # fileNumber [ , exprList ]


# fileNumber

The file number that LotusScript® assigned to the file when it was opened. You must include both the pound sign (#) and the file number.


Optional. The list of String or numeric expressions to be written to the file, separated with commas.

If you omit exprList, Write # writes a blank line to the file.

The exprList can't include arrays, lists, type variables, or objects. The exprList can include individual array elements, list elements, or type members.


Use Write # only with files opened for either Output or Append.

Use the Input # statement to read data written by Write #.

Write # ignores the file width set by the Width # statement. Data items are separated with commas, and a newline character is inserted after all data has been written to the file.

LotusScript® inserts "chr(10)" to represent the newline character in any multi-line string (for example, a string that you type in using vertical bars or braces). If you Print the string to a file, this newline character will be translated into the platform-specific newline character(s). If you Write the string to a file, no translation is done.

Note: Newline does not mean either chr(10) or chr(13) on all platforms. Newline is the character or sequence of characters that is used to mark the end of a line. This may be chr(10), or chr(13), but it may also be something else, because the actual value of newline depends on the platform.
Note: When reading a multiline string from a sequential file written by the Write # statement, use Input, not Line Input.

The following table shows how the Write # statement behaves with various data types specified in exprList.

Data type

Write # statement behavior


Omits leading and trailing spaces.


Encloses all strings in double quotation marks. Pads fixed-length strings with spaces as needed.

Variant of DataType 7 (Date/Time)

Uses one of the following date formats:

#yyyy-mm-dd hh:mm:ss#



If either the date part or the time part is missing from the value, LotusScript® writes only the part provided to the file.

Variant with the value EMPTY

Writes a comma without data to the file. If that variable is the last item on the line, the comma is omitted.

Variant with the value NULL

Writes the string NULL to the file.