Tandy 1000 Basic Reference Manual page 279

Hide thumbs Also See for 1000:
Table of Contents

Advertisement

Chapter 10 I BASIC Keywords
The comma tells BASIC t o tab between A and B, which creates
10 extra spaces in the file. Generally you do not want
to
use up
storage space this way, so you use semicolons instead of commas.
P R I N T # 1 ,
A ;
"
,
' I *
This time BASIC writes the data as:
1 2 3 . 4 5 , l . 3 0 3
An INPUT# statement reads this as 2 separate fields.
If s t r i n g variables contain commas, semicolons, or leading
blanks, enclose them in quotation marks. For example:
A $
=
CAMERA,
A U T O M A T I C
E$
=
1 0 2 3 8 2
P R I N T #
1 , A $ ;
E$
writes the data as:
C A M E R A M M M ~ M M M M ~ ~ A U T O M A T I C l 8 2 3 8 2
An INPUT# statement reads this as 2 separate fields
A $
=
CAMERA
E$
=
A U T O M A T I C 1 8 2 3 8 2
To separate these 2 strings properly in the file, write quotation
marks using the hexadecimal representation CHR$(34). For
example
:
P R I N T # 1 , C H R $ ( 3 4 ) ;
A $ ;
C H R $ ( 3 4 ) ;
E $ ;
C H R s ( 3 4 )
BASIC writes the following image to the file:
"CAMERA, A U T O M A T I C " 1 0 2 3 8 2 "
T h e s t a t e m e n t I N P U T #
1, A$,
B$
r e a d s " C A M -
ERA,AUTOMATIC" into A$ and "102382" into B$.
277

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents