Skip to content

PUT

Write to Disk by Sector

This directive writes data to a specific disk sector rather than to an OPEN file. This directive is available only in MS-DOS but is not valid on DOS network drives.

PUT disk-num, sector-num [,ERR=line-ref|,ERC=error-code],
string-variable [,verification]
disk-num
specifies the logical disk directory that will contain this data. Valid values are 0 through 35.
sector-num
is an integer specifying the number of the 256-byte sector to which to start writing.
line-ref
is the program line number or label to branch to if this directive produces an error.
error-code
is a programmer-defined error code. Valid values are positive or negative whole numbers.
string-variable
is the name of a string variable that holds the data to be written to the disk.
verification
is the name of a string variable that is equal in length to string-variable, which contains the value that the disk indicates, was actually written.

For the verification option, string-variable and verification must be of equal length and verification must have been defined prior to the PUT directive. If the lengths are not the same, an ERR=17 results.

Care must be used when executing this directive since it has the effect of irretrievably writing over data on the disk.

If an attempt is made to PUT data to a disk-num that has not been DISABLEd, an ERR=14 results (see DISABLE directive).

PUT 2, 4, A$

accesses the disk containing logical disk directory 2 and writes the data contained in A$ onto the disk starting at sector 4 for as many bytes as are contained in A$.

PUT X, Y, ERR=7800, A$, B$

If X = 2 and Y = 4 has the same effect as the first example and branches to statement 7800 if an error occurs while processing this directive. If the values of A$ and B$ do not match after this operation, an error is produced.

GET directive

From the Thoroughbred Basic Language Reference, Volume II: F–Q, version 8.9.1. Open this page in the PDF