PUT¶
Syntax¶
Versions: Disk
Purpose¶
To write a record from a random buffer to a random file.
Remarks¶
Example¶
10 OPEN "R", 1, "INVENTORY.DAT", 128
20 FIELD #1, 20 AS ITEM$, 4 AS PRICE$, 2 AS QTY$
30 LSET ITEM$ = "Widget"
40 LSET PRICE$ = MKS$(29.95)
50 LSET QTY$ = MKI%(100)
60 PUT #1, 5 ' Write to record 5
70 CLOSE #1
Note: PRINT#, PRINT# USING, and WRITE# may be used to put characters in the random file buffer before a PUT statement. In the case of WRITE#, BASIC-80 pads the buffer with spaces up to the carriage return. Any attempt to read or write past the end of the buffer causes a "Field overflow" error.
See Also¶
- GET - Read a random file record
- FIELD - Define field variables for random file
- OPEN - Open a random access file
- LSET - Left-justify strings in a field
- RSET - Right-justify strings in a field
- MKI, MKS, MKD$ - Convert numbers to strings for fields
- LOC - Get next record number for random files
- LOF - Get file length
- CLOSE - Close file when done