HP Pascal/iX Reference Manual (31502-90022)

10- 19
reset
Usage
reset
(f)
reset
(f, s)
reset
(f, s, t)
Parameters
f
A file variable that may not be omitted.
s
The name of a physical file that the system associates with
f
.
s
may be a string or PAC expression.
t
An options string that may be a string or PAC expression whose value
is implementation dependent.
Description
The procedure reset
(f)
opens the file
f
in the input state and places the
current position at the first component. The contents of
f
, if any, are
undisturbed. The file
f
may then be read sequentially.
If
f
is not empty, eof
(f)
is false, and a subsequent reference to the
buffer variable
f^
actually loads the buffer with the first component.
The components of
f
may now be read in sequence. If
f
is empty, however,
eof
(f)
is true and
f^
is undefined, then subsequent calls to read are
errors.
If
f
is already open at the time reset is called, the system
automatically closes and then reopens it, retaining the contents of the
file. If the parameter
s
is specified, the system closes any physical
file previously associated with
f
.
When
f
does not appear as a program parameter and
s
is not specified, the
system maintains any previous association of a physical file with
f
. For
more information on opening files, see the
HP Pascal/iX Programmer's
Guide
or the
HP Pascal/HP-UX Programmer's Guide
, depending on your
implementation.
Example
reset(file_var)
reset(file_var,file_name)
reset(file_var,file_name,opt_str)
Illustration
Suppose examp_file is a closed file of char with three components. To
read sequentially from examp_file, we call reset: