Chapter
21
Loading
MS-DOS
and
BASIC
Examples
BASIC
DAILY >DAILY.OUT
initializes BASIC and runs the program DAILY. Redirects all
output, normally sent to the screen, to the file DAILY.OUT.
BASIC
DAILY <DAILY.IN
initializes BASIC
and
executes the program DAILY. DAILY re-
ceives all input, normally entered through the keyboard, from
the file DAILYJN.
BASIC
SAMPLE
<TSTDATA.IN >TSTDATA.OUT
initializes BASIC and executes the program SAMPLE. SAMPLE
receives input from TSTDATA.IN and sends output to
TSTDATA. OUT.
BASIC
PAYROLL
<WEEK25
>>YTDTOTAL
initializes BASIC and executes the program PAYROLL. PAY-
ROLL receives input from the file WEEK25. The output is ap-
pended to the file YTDTOTAL.
Hints
for
redirection
of
input and output:
0
File input from the KYBD: device still reads from the
0
File output to the SCRN: device still outputs to the screen.
0
BASIC still traps keys when you use the
ON
KEY0
[CsRLjm]
tells BASIC to close all open files, then issue the
message “Break
in
line
xxxx”
to
standard output. Control re-
turns to
MS-DOS.
0
Redirected input continues until BASIC receives
a
[CTRLJ[T].
This condition can be tested by the EOFO function. If the in-
put file
is
not terminated by
a
[CTRL][T]
or
a
BASIC file input
statement tries to read past the end-of-file, BASIC closes any
open files and issues the message “Read past end” to standard
output. Control returns to MS-DOS.
e
The printer echo key combination
([CTRL][PRlNT)),
which nor-
mally causes all output on the display to be echoed on LPTl:,
will not work if you redirect standard output.
keyboard.
statement
.
24