PUT
This page was last modified 15:08, 8 November 2021 by Mars2000you. Based on work by Gdx and NYYRIKKI.

Contents

Effect

Writes a record from record buffer to opened random access file.

The record buffer must have been previously filled with the LSET or RSET instruction.

Note: Unused records on new formatted disks are filled with CHR$(229).

Syntax

PUT #<FileNumber>,<RecordNumber>

The last parameter is optional. Parameters can not end with a comma alone.

Parameters

<FileNumber> is the number of the open file, it can vary between 1 and 15, but can't exceed the maximum number of files eventually defined with MAXFILES. The front # is optional.

<RecordNumber> is a record number in integer format. Record size can be defined with the OPEN instruction. First record is 1. If this parameter is not given a next record is assumed. The file size will be automatically increased if record points to outside of file.

Example

To initialize all records:

10 OPEN "SUPERDAT.DAT" AS #1 LEN=66
20 FIELD #1, 66 AS X$
30 LSET X$=STRING$(66,229)
50 FOR I=1 TO 2000
60 PUT #1, I
70 NEXT
80 CLOSE

Related to

CLOSE, FIELD, GET, LSET, MAXFILES, OPEN, RSET, VARPTR

Compatibility

Disk BASIC 1.0 or higher / both modes of Nextor OS