HP Pascal/iX Reference Manual (31502-90022)
Table Of Contents
- Top of Document
- Preface
- Chapter 1 Introduction
- Chapter 2 Language Elements
- Chapter 3 Data Types
- Chapter 4 Expressions
- Chapter 5 The Declaration Section
- Chapter 6 Statements
- Chapter 7 Program Structure
- Chapter 8 Procedures and Functions
- Chapter 9 Standard Routines
- Chapter 10 Input and Output
- Chapter 11 System Programming Extensions
- Chapter 12 Compiler Options
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: