Tandy 1000 Basic Reference Manual page 76

Hide thumbs Also See for 1000:
Table of Contents

Advertisement

Chapter
71
Disk Files
5. Convert string values back to numbers using the "convert"
functions: CVI for integers, CVS for single precision values,
and CVD for double precision values. For example:
PRINT
N $
PRINT CVS(A$)
The program may now access the data in the buffer.
The following program accesses the direct access file list-
ing.dat (created with the previous program). When BASIC ex-
e c u t e s L i n e 3 0 , e n t e r a n y valid record n u m b e r from
1isting.dat. This program prints the contents of that record.
10 OPEN
"R",
1 ,
" l l 5 t l n g . d a t " ,
32
20 FIELD 1,20
A S
N$,4
A S
A $ , 8
A S
P $
30 RECSIZE%
=
32
50 IF CODE% = 0 OR CODE% > (LOF(l)/RECSIZE%)
THEN
1000
6 0 GET
# I ,
CODE%
70 PRINT
N $
80 PRINT USING
' I $ $ # . # # " ;
CVSCA$)
9 0 PRINT P$: PRINT
100 GOT0 40
1000 CLOSE 1
40 INPUT "2-DIGIT CODE, 0 TO END"; CODE%
After typing this program, save it and run it. When BASIC
asks you t o enter a 2-digit code, enter 20 (the record created
through the previous program). Your display should show:
2-DIGIT CODE, 0
TO
END? 20
S M
I
TH
$34.55
567-9000
To update listing.dat, simply use LOAD to load the previous
program (the one that created listing.dat) and run it.
74

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents