Tandy 1000 Basic Reference Manual page 74

Hide thumbs Also See for 1000:
Table of Contents

Advertisement

Chapter
71
Disk Files
3. To move data into the buffer, use the LSET statement. Nu-
meric values must be converted to strings when placed in the
buffer. To do this, use the make functions: MKI$ t o make an
integer value into a string, MKS$ for a single precision value,
and MKD$ for a double precision value. For example:
L S E T
N S = X S
L S E T A $ = M K S S C A M T )
4.
To write data from the buffer to a record (within a direct ac-
cess disk file), use the PUT statement. For example:
PUT 1 , CODE%
writes the data from Buffer 1 to a record with the number
CODE%. (The percentage sign a t the end of a variable speci-
fies that it is a n integer variable.)
The following program writes information to a direct access
file:
1 0 OPEN
" R " ,
1 , " l i 5 t i n g . d a t " , 3 2
2 0 F I E L D 1 , 2 0 A S N S , 4 A S A S ,
8 A S PS
30 I N P U T " 2 - D I G I T
CODE,
0 TO END";
CODE%
4 0 I F CODE%
=
0 THEN 1 3 0
5 0 I N P U T "NAME";
X S
6 0
I N P U T "AMOUNT";
AMT
7 0 I N P U T "PHONE";
T E L S
8 0 L S E T
N S
=
X S
90 L S E T A S
=
M K S $ ( A M T )
1 0 0 L S E T
P S
=
T E L S
1 1 0 PUT 1 , CODE%
1 2 0 GOT0 3 0
1 3 0 CLOSE
1
The 2-digit code that you enter in Line 30 becomes a record
number. That record number stores the name(s1, amount(s1,
and phone number(s) you enter when Lines 50, 60, and 70 are
executed. The record is written to the file when BASIC exe-
cutes the PUT statement in Line 110.
72

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents