already dimensioned D$ as an array which contains 100 elements. These ele-
ments are to be written to the disk in records number 1 through 100 of file
FILE1. This could be accomplished with the following program segment:
*
*
*
110 DOPEN#1,”FILE1”,D0
120 GOSUB 190
130 FOR I=1 TO 100
150 PRINT#1,D$(I)
160 GOSUB 190
170 DCLOSE#1
180 END
190 IF DS<20 THEN RETURN
200 PRINT DS$
210 STOP
Since the record pointer is automatically set to record 1 when the file is opened,
record 1 is the first record written. If no RECORD command is executed the
DOS automatically positions to the next record after each PRINT. Therefore,
the contents of D$ will be written to records 1 through 100 of the file.
For detailed description of related BASIC commands, refer to Chapter 4 of this
manual and the BASIC 4.0 reference manual.
69