Node: Text_IO Reading and Writing Non-Regular Files, Next: , Previous: Text_IO Stream Pointer Positioning, Up: Text_IO



Reading and Writing Non-Regular Files

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:

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 signalled 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.