Sharp MZ-700 Series Owner's Manual page 71

Personal computer
Hide thumbs Also See for MZ-700 Series:
Table of Contents

Advertisement

(Example 3)
The following program creates a data file consisting of string data.
1 0
D I M
N $
( 5 )
2 0
N $ ( 1 ) = " B A C H "
3 0
N S ( 2 ) = " M O Z A R T "
4 0
N $ ( 3 ) = " B E E T H O V E N "
5 0
N S ( 4 ) = " C H O P I N "
6 0
N S ( 5 ) = " B R A H M S "
7 0
W O P E N " G R E A T
M U S I C I A N "
8 0
F O R
J = 1
T O
5
9 0
P R I N T / T
N S C J )
1 0 0
N E X T
J
1 1 0
C L O S E
1 2 0
E N D
(Example 4)
The following program reads string data from the file created in Example 3. Before executing this
program, be sure to rewind the cassette tape.
2 0 0
D I M
M S
( 5 )
2 1 0
R O P E N
" G R E A T
M U S I C I A N "
2 2 0
F O R
K = 1
T O
5
2 3 0
I N P U T / T
M S CK)
2 4 0
P R I N T
M S CK)
2 5 0
N E X T
K
2 6 0
C L O S E
2 7 0
E N D
It is also possible to create data files which include both numeric and string data. However, since an
error will occur if the type of data read does not match the type of variable specified in the INPUT/T
statement, it is generally best to limit files to one type of data or the other.
Note: It is possible to omit the file name when opening a sequential file with the WOPEN statement.
However, this is likely to result in errors if many files are included on the same tape; therefore,
it is recommended that you make a habit of assigning file names to sequential data files.
69-

Advertisement

Table of Contents
loading

Table of Contents