## Example 2: Procedure ReadRadixRepresentation 

A generalized procedure to read integers expressed in any radix from 2 to 16 is presented. 

type Radix 2 .. 16; procedure ReadRadixRepresentation (var F: Text; {contains the representation } var E: Boolean; var X: Integer; R: Radix { indicates presence of errors } {set to result if no errors occur} { radix of representation } ) ; ReadRadixRepresentation assumes that text file F is positioned to read a sequence of extended digits as a radix-R representation of an integer. The extended digits, in ascending order, are: '0' ,'1' ,'2' ,'3' ,'4' ,'5' ,'6' ,'7', '8' ,'9' ,'a' ,'b' ,'c' ,'d' ,'e' ,'f' Upper-case letters corresponding to the lower-case letters may be used. The parameter E indicates whether one of the following errors occurred: (1) The textfile F was not positioned to a sequence of extended digits. (2) The sequence of digits represents an integer greater than Maxint. (3) The sequence of extended digits contains a digit that is not a radix-R digit. } type DigitRange 0 .. 15; var 0: DigitRange; V: Boolean; s: 0 .. Maxint; 

