Futurebasic/Language/Reference/write file

From Wikibooks, open books for an open world
Jump to navigation Jump to search

WRITE FILE[edit | edit source]

statement[edit | edit source]

Syntax[edit | edit source]

Write File[#] deviceID, address&, numBytes&

Description[edit | edit source]

This statement writes numBytes& 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.

Example[edit | edit source]

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

_maxSubscript = 200
Dim myArray%(_maxSubscript)
arrayBytes& = (_maxSubscript+1) * SizeOf(Int)
:
Write File #1, @myArray%(0), arrayBytes&

See Also[edit | edit source]

Write#; Write Field; Read File;