content_image/858653.jpg
<img src='content_image/858653.jpg'>

## 12. Textfile Input and Output 

The basis for legible input and out lut are textfiles (see Section 6.2.4) that are passed as program paramders (see Section 13) to a Pascal program and that in the program \ environment may represent some input or output devices such as a ke ,I board, display, a magnetic tape, or a line printer. In order to facilita I,' the handling of textfiles, three predeclared procedures (Readln, VI it eln, and Page) are introduced, and two predeclared procedures (d d and w r i t e - see Section 11.4.1) are extended. The textfiles hat these procedures apply to need not represent input or output devic~s, but can also be local files. The actual parameter lists for these procedures do not conform to the usual rules (Section 11.3), allowing amon 2. other things for a variable number of parameters. Moreover, the paran ,ders need not be of type Char, but also may be of certain other types in which case the data transfer is accompanied by an implicit data \.:ol1version operation. If the first parameter is a file variable, then tl i" is the file to be read or written. Otherwise, the program parameter ~ ,lput and Output (see Section 13) are assumed for reading and w iting, respectively. 

## 12.1 Read 

When using Read on a textfile, the: ollowing rules apply. Let f denote a textfile, and let vI, ... ,vn deno\< variables possessing type Char or Integer (or subrange of either) or R ,~al. 

