This package declares a file type named text that can be used to read and write to and from text files. The predefined file, input, is a special file that designates the keyboard input. Anything written to the special predefined file, output, is displayed on the screen.
The readline and writeline procedures are used to read and write from text files. The readline procedure reads one text line from the input file and puts it in the line variable passed in. The writeline procedure writes the contents of the line variable passed in and makes that line an empty string. The endfile function can be used as with normal files to determine if an input file has reached the end.
The many read and write procedures read and write values to and from a string. The read procedure attempts to read a value of the type of the value variable. If the read procedure is used with the good output, then good is set to true if the read operation was successful. For example, the read procedure for integer values could be used to read from the string "3", but the read procedure for bit values would be unsuccessful because 3 is not a valid value for the bit type. Every time a value is read from a line, that portion of the string is removed until it is eventually empty. The endline function returns true if the line passed in is empty.
The write procedure writes a value to a string by appending it to the end of the string passed in. The justified parameter can be used to specify if the text is left- or right-justified in its field width. The field width is specified by the field parameter. If this parameter is zero, then the field width is whatever width is required. The write procedure for real values has an extra parameter, digits. This parameter is the number of digits of precision that will be used. If this parameter is zero, then the standard exponent form is used. The write procedure for the time type also has an extra parameter, unit. This parameter specifies what unit to use.