Chapter 6 RAPID!
Commands
180 WCDMA Options Version 6.20
OPEN (on communication
ports)
Description
Opens a file or a communication port for input or output
operations. As long as a file has not been opened, I/O
operations can not be performed and a runtime error will
occur.
filename$ is a string, containing either a valid file
name or a specification for a communication port of the
4400 (please see below for details).
openMode may either be INPUT, OUTPUT or APPEND.
When
openMode is INPUT, then the file can only be
read from. If the file does not exist, a runtime error will
occur.
In case,
openMode is OUTPUT, then it is only possible to
store data to that file. If the file does not exist, it will be
created anew. Should the file already exist, then it will be
overwritten without warning.
openMode APPEND is similar to OUTPUT. However, the
file will not be overwritten with new data. Instead, new
data will be added at the end of the existing file. Should
there be no file, it will be created anew.
Notes:
– When a file is already open, a further
OPEN command
may open the same file as long as the mode is identi-
cal. If the mode is not identical (e.g. a file was opened
for output previously and shall now be opened for
input), a runtime error will occur.
–
OPEN may also be used to open a path to the SCPI
system. See section SCPI and RAPID! for details.
Examples
This example writes a string to a text file.
LET File=FREEFILE
OPEN "STRINGS.TXT" FOR OUTPUT AS
#File
PRINT #File, "Save me"
CLOSE #File
Syntax
OPEN fileName$ AS #fileNo
Parameters
fileName$ is a string expression containing a specifi-
cation for a communication port on the 4400 or a valid
file name (please see above for details).
fileNo is a numeric expression resulting in a positive inte-
ger (the so-called file handle).