Sharp MZ-700 Basic Manual page 22

Disk basic interpreter
Hide thumbs Also See for MZ-700:
Table of Contents

Advertisement

21
• To find the data end
What would happen if the data being read-out in order from the file surpass the
number of data registered? In this case, an error does not occur. And a zero or blank
is set in the read-out variable, but there is a special function EOF (#n) (page 56)
which can detect the data end. When there is a data read-out by an INPUT command,
EOF (#n) becomes a true condition when there is no data.
As a result, if the
IF EOF
(#n)
THEN
command is placed after the INPUT # command, then if EOF (#n) becomes "true",
i.e. if the end of the data is found, the command after THEN will be executed.
Here use the practice problems to become sufficiently accustomed to the use of the
BSD file.
Practice problems
Problem 1
Using the program example on the previous page, change the program assuming that
the number of people registered is unknown, read-out the file 10 persons at a time
until the end of the file is reached and display them.
Example solution
The following program might, for example, be considered.
300
ROPEN #5,
" F D 1
ADDRESS LI ST"
3 1 0 FOR
I =1
TO 1 0
320
INPUT #5,
NA$,
AD$
330
I F E OF
( #5)
THEN 400
350
NEXT
360
PRI NT " PUSH SPACE KEY"
370
GET X$:
I F X$
THEN 310
380 GOTO 370
400
CLOSE
#5
410
PRI NT
" F I LE
END" :
END

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mz-2z009

Table of Contents