Example Of A Sequential File Program 5Q - Commodore vic-1540 User Manual

Table of Contents

Advertisement

STEP4
Open the file with a name DATA to be read out.
The designation R for read out may be omitted.
OPEN #2,8,2, "0: DATA, S,R"
STEP 5
Read in the data from the sequential file to the program using
INPUT #.
INPUT#2,X$)Y$,Z$
STEP 6
Check the end of the file by the ST variable.
IF (ST) AND 64 THEN CLOSE 2
EXAMPLE OF A SEQUENTIAL FILE PROGRAM
An example of a simple program to create a sequential file is shown below.
Records consisting of string field and numeric field are written in and the con
tents of the records is displayed at the end by typing END.
1 REM ***************
2 REM *
EXfiMPLE
3 REM * REfiB & WRITE
4 REM * fl SEQUENTIfll
5 REM * DflTfl FILE
9 REM ***************
10 PRINT"3BW»i!INITIRlIZE DISK."
29 DIMfl*<25>
30 DIME<25>
40 OPEN15,8,15,"I0"
60 GOSUB 1000
70 CRS=CHRf<13)
80 PRINT
90 PRINT" WWRITE SEQ TEST FILES"
95 PRINT
10Q REM *.**♦******♦**
101 REM *
102 REM *
WRITE SEQ
103 REM ♦
TEST FILE
104 REM *
50

Advertisement

Table of Contents
loading

Table of Contents