FutureBasic Logo

<<    Index    >> FutureBasic

write   statement

write[ # ] deviceID, { var | stringVar;len } [ , { var | stringVar;len }...]

This statement writes the contents of the specified variables to the open file or serial port specified by deviceID, starting at the current "file mark" position. The variables in the list can be of any type (including record types).

If you specify a string variable, it must be followed by a len parameter, which indicates the number of bytes to copy from the string. len can be any positive numeric expression whose value doesn't exceed the length of the string. If the actual length of the string, based on its contents, doesn't match the programmer-supplied string length in the len parameter, there are two behaviors: Unlike the print# statement, the write statement does not apply any formatting to the data before writing it. Instead, it simply writes an exact copy of the variables' internal bit patterns to the device. This makes the written data suitable for input by the read# statement. In general, the data written by write is not suitable for files which are to be interpreted as text.

See also
print#; read#; input#; open