User`s guide
If the program is resumed, the terminal and the manual control pendant are automatically
reattached if they were attached before the termination.
NOTE: It is possible that another program task could have attached the terminal or
manual control pendant. That would result in an error message when the stopped task is
restarted.
Reading
The READ instruction processes input from all devices. The basic READ instruction issues a
request to the device attached on the indicated LUN and waits until a complete data record is
received before program execution continues. (The length of the last record read can be
obtained with the IOSTAT function with its second argument set to 2.)
The GETC real-valued function returns the next data byte from an I/O device without waiting
for a complete data record. It is commonly used to read data from the serial lines or the
system terminal. It also can be used to read disk files in a byte-by-byte manner.
Special mode bits to allow reading with no echo are supported for terminal read operations.
Terminal input also can be performed using the PROMPT instruction.
The GETEVENT instruction can be used to read input from the system terminal. This may be
useful in writing programs that operate on both graphics and nongraphics-based systems.
To read data from a disk device, a file must be open on the corresponding logical unit. The
FOPEN_ instructions open disk files.
Writing
The WRITE instruction processes output to serial and disk devices and to the terminal. The
basic WRITE instruction issues a request to the device attached on the indicated LUN, and
waits until the complete data record is output before program execution continues.
WRITE instructions accept format control specifiers that determine how output data is
formatted, and whether or not an end of record mark should be written at the end of the
record.
Terminal output also can be performed using the PROMPT or TYPE instructions.
A file must be open using the FOPENW or FOPENA instructions before data can be written to a
disk device. FOPENW opens a new file. FOPENA opens an existing file and appends data to
that file.
Input Wait Modes
Normally, V+ waits until the data from an input instruction is available before continuing with
program execution. However, the READ instruction and GETC function accept an optional
argument that specifies no-wait mode. In no-wait mode, these instructions return
immediately with the error status -526 (No data received) if there is no data available. A
Serial and Disk I/O Basics
V+Language User's Guide, v17.0
Page 212










