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- 17
----------------------------------------------------------------------------------------------
| | | |
| (space)Pas(end-of-line)cal | PAC {length 9} | '_Pas_____' |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| (end-of-line)Pascal | PAC {length 5} | '_____' |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| (space)Monday(space) | enumerated | MONDAY |
| | | |
----------------------------------------------------------------------------------------------
readdir
Usage
readdir
(f, k, v)
readdir
(f, k, v1, ..., vn)
Parameters
f
A file variable open to read that is not a textfile.
k
The index of a component in
f
.
v
The name of a variable or component of a structure whose type is not
FILE and does not contain a component of type FILE.
Description
The procedure readdir(
f, k, v)
places the current position at component
k
, and then reads the value of that component into
v
. The index,
k
, is
relative to the beginning of the file. Formally, this is equivalent to:
seek(f,k);
read(f,v);
The call get(
f
) is not required between seek and read because of the
definition of read. The procedure readdir can be used only with files
opened for direct access. Therefore, a textfile cannot appear as a
parameter for readdir.
Example
readdir(file_var,indx,variable)
readdir(file_var,indx,variable1,...,variablen)
Illustration
Suppose examp_file is a file of integer with four components just opened
in the direct access state. The current position is the first component.
To read the third component into int_var, readdir is called. After
readdir executes, the current position is the fourth component.