Put

Writes data from a variable to a disk file.

Syntax

file.Put Data, [Recnumber]

The parts of the Put statement syntax are described in the following table.

Part Description
Data Required. Variant variable containing data to be written to disk.
Recnumber Optional. Variant (Long). Record number (Random mode files) or byte number (Binary mode files) at which writing begins.

Remarks

Data written with Put is usually read from a file with Get.

The first record or byte in a file is at position 1, the second record or byte is at position 2, and so on. If you omit recnumber, the next record or byte after the last Get or Put statement or pointed to by the last Seek function is written.

For files opened in Random mode, the following rules apply:

You can use the Put statement to write a Variant array to disk, but you cannot use Put to write a scalar Variant containing an array to disk. You also cannot use Put to write objects to disk.