PUT Statement (Files)


To write a record from a random buffer to a random disk file.


PUT[#]file number[,record number]


file number is the number under which the file was opened.

record number is the number of the record. If it is omitted, the record has the next available record number (after the last PUT).

The largest possible record number is 232 -1. This will allow you to have large files with short record lengths. The smallest possible record number is 1.

The PRINT#, PRINT# USING, LSET, RSET, or WRITE# statements may be used to put characters in the random file buffer before a PUT statement.

In the case of WRITE#, GW-BASIC pads the buffer with spaces up to an enter.

Any attempt to read or write past the end of the buffer causes a "Field overflow" error.

PUT can be used for communications files. Here record number is the number of bytes written to the file. Record number must be less than or equal to the length of the buffer set in the OPEN "COM(n) statement.