FutureBasic Logo

<<    Index    >> FutureBasic

write file   statement

write file [ # ] deviceID, address, numberBytes

This statement writes numberBytes of data to the open file or serial port specified by deviceID, starting at the current "file mark" position. The data is copied from the memory which starts at address. This is generally the fastest way to write a large amount of data to a file.


This program fragment saves the binary image of an array into an open file. You can later use the read file statement to load the array using the data in the file (see the example accompanying the read file statement).

_maxSubscript = 200
dim myArray(_maxSubscript) as SInt16
dim asUInt32 arrayBytes

arrayBytes = (_maxSubscript + 1) * sizeof( SInt16 )
write file #1, @myArray(0), arrayBytes

See also
open; write; read file