If any of these procedures and functions are used without indication of a file parameter, the default convention specifies that the standard file Input or Output is assumed; in which case, it must be placed in the parameter list of the program heading. 

Note: The effect of applying the predeclared procedure Reset or Rewrite to either Input or Output is implementation-defined. 

Accordingly, reading and writing a textfile can be expressed as follows (assume var Ch: Char; B1, B2: Boolean; and P, Q, and R user -defined procedures). 

## Writing characters on file Output: 

## Reading characters from file Input: 

repeat repeat P(Ch); Write(Ch) until B1; Writeln until B2 

while not eof do begin {process a line} P; while not eoln do begin Read(Ch); Q(Ch) end; R; Read1n end 

The next two examples of programs show the use of the textfiles Input and Output. (Consider what changes would be necessary if only Get and Put, not Read and Write, were to be used.) 

program LetterFrequencies(Input,Output); { Program 12.1 - Perform a frequency count of letters in the Input file; echo the input. } type Natural var Ch: Char; O •• MaxInt; Count: array [Char] of Natural; Letters, Upper, Lower: set of Char; 

