A non-regular file is a device (such as a keyboard), or a pipe. Text_IO can be used for reading and writing. Writing is not affected and the sequence of characters output is identical to the normal file case, but for reading, the behavior of Text_IO is modified to avoid undesirable look-ahead as follows:
An input file that is not a regular file is considered to have no page
marks. Any Ascii.FF
characters (the character normally used for a
page mark) appearing in the file are considered to be data
characters. In particular:
Get_Line
and Skip_Line
do not test for a page mark
following a line mark. If a page mark appears, it will be treated as a
data character.
End_Of_Page
always returns False
End_Of_File
will return False
if there is a page mark at
the end of the file.
Output to non-regular files is the same as for regular files. Page marks
may be written to non-regular files using New_Page
, but as noted
above they will not be treated as page marks on input if the output is
piped to another Ada program.
Another important discrepancy when reading non-regular files is that the end
of file indication is not ’sticky’. If an end of file is entered, e.g., by
pressing the EOT
key,
then end of file
is signaled once (i.e., the test End_Of_File
will yield True
, or a read will
raise End_Error
), but then reading can resume
to read data past that end of
file indication, until another end of file indication is entered.