basic

## Print # Statement

1. Print # filenumber, [ [{Spc(n) | Tab(n)}][ expressionlist] [{; | ,}] ]

Writes data to a sequential file.

Print statement Description:

filenumber:

Number used in an Open statement to open a sequential file. It can be any number of an open file. Note that the number sign (#) preceding filenumber is not optional.

Spc(n):

Name of the Basic function optionally used to insert n spaces into the printed output. Multiple use is permitted.

Tab(n):

Name of the Basic function optionally used to tab to the nth column before printing expressionlist. Multiple use is permitted.

expressionlist :

Numeric and/or string expressions to be written to the file.

{;|,}

Character that determines the position of the next character printed. A semicolon means the next character is printed immediately after the last character; a comma means the next character is printed at the start of the next print zone. Print zones begin every 14 columns. If neither character is specified, the next character is printed on the next line.

If you omit expression list, the Print # statement prints a blank line in the file, but you must include the comma. Because Print # writes an image of the data to the file, you must delimit the data so it is printed correctly. If you use commas as delimiters, Print # also writes the blanks between print fields to the file.

The Print # statement usually writes Variant data to a file the same way it writes any other data type. However, there are some exceptions:

- If the data being written is a Variant of VarType 0 (Empty), Print # writes nothing to the file for that data item.

- If the data being written is a Variant of VarType 1 (Null), Print # writes the literal #NULL# to the file.

- If the data being written is a Variant of VarType 7 (Date), Print # writes the date to the file using the Short Date format defined in the WIN.INI file. When either the date or the time component is missing or zero, Print # writes only the part provided to the file.

The following example writes data to a test file.

More:

Example: