Chapter 7
RAPID!
Commands
294
4460 GSM System Option and 4468 EDGE System Option
Version 12.20
Commands for input/
output handling
These commands enable special input/output tasks related to the 4400’s disk
drive, hard disk and communication ports.
Frequently, input/output operations are abbreviated with I/O.
CLOSE
INPUT
Command
Short description
CLOSE
Closes a previously opened file.
INPUT
Reads data from an open file or from an open port.
OPEN
Opens a file or a port and allows for reading or writing
data.
or
OUTPUT
Writes data to an open file or port.
Syntax
CLOSE [fileNo]
Parameters
fileNo
is a numeric expression, representing a valid file
number.
fileNo
must result in a positive integer.
Software people tend to call
fileNo
the ‘file handle’.
Description
Closes the file with the specified
fileNo
.
After the file has been closed,
fileNo
is no longer
related to the initial file and may be used again later to
open a completely different file.
If
fileNo
is omitted, then all currently open files will be
closed.
As long as a file is closed, it is not accessible for I/O oper-
ations unless it is opened again, using the
OPEN
com-
mand (please see below for details).
Example
The following example program reads a text file and
stores the data read from the file in a string array.
LET i=0
OPEN "STRINGS.TXT" FOR INPUT AS #1
DO WHILE NOT EOF(1)
LET i=i+1
INPUT #1, theStrgs$(i)
LOOP
CLOSE #1
Syntax
INPUT #fileNo , variable
Parameters
fileNo
is a numeric expression resulting in a valid file
handle (a positive integer).
variable
is a numeric or string variable.