FutureBasic Logo

<<    Index    >> FutureBasic 5

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
dim as UInt32 arrayBytes

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

See Also:
open; write; write field; read file