HP Pascal/iX Reference Manual (31502-90022)

10- 22
Parameters
f
A file variable that must be open in the output or direct access
state.
e
A variable or expression whose type is not FILE and which does not
contain a component of type FILE.
Description
The procedure write
(f, e)
assigns the value of
e
to the current component
of
f
and then advances the current position. After the call to write,
the buffer variable
f
^ is undefined. It is an error if
f
is not open in
the output or direct access state. It is also an error if the current
position of a direct access file is greater than maxpos (
f
).
If
f
is not a textfile,
e
must be an expression whose result type is
assignment compatible with the components of
f
. If
f
is a textfile,
e
may be an expression whose result type is any simple, string, or PAC
type. Also, the value of
e
may be formatted as it is written to a
textfile as described later in this chapter.
The call write
(f, e)
is equivalent to accessing the file variable,
f
, and
establishing a reference to that file variable for the remaining
execution of the statement denoted by
ff
.
The call write
(f,e1,...en)
is equivalent to:
write(ff,e1);
write(ff,e2);
.
.
write(ff,en);
Example
write(file_var,exp:5)
write(file_var,exp1,...,expn)
write(exp)
write(exp1,...,expn)
Illustration
Suppose examp_file is a file of integer opened in the output state, and
that one number has been written to it. To write another number, write
is called again: