Next: Wide_Text_IO, Previous: Sequential_IO, Up: The Implementation of Standard I/O [Contents][Index]
Text_IO files consist of a stream of characters containing the following special control characters:
LF (line feed, 16#0A#) Line Mark FF (form feed, 16#0C#) Page Mark
A canonical Text_IO file is defined as one in which the following conditions are met:
LF is used only as a line mark, i.e., to mark the end
of the line.
FF is used only as a page mark, i.e., to mark the
end of a page and consequently can appear only immediately following a
LF (line mark) character.
LF (line mark) or LF-FF
(line mark, page mark). In the former case, the page mark is implicitly
assumed to be present.
A file written using Text_IO will be in canonical form provided that no
explicit LF or FF characters are written using Put
or Put_Line. There will be no FF character at the end of
the file unless an explicit New_Page operation was performed
before closing the file.
A canonical Text_IO file that is a regular file (i.e., not a device or a pipe) can be read using any of the routines in Text_IO. The semantics in this case will be exactly as defined in the Ada Reference Manual, and all the routines in Text_IO are fully implemented.
A text file that does not meet the requirements for a canonical Text_IO file has one of the following:
FF characters not immediately following a
LF character.
LF or FF characters written by
Put or Put_Line, which are not logically considered to be
line marks or page marks.
LF or FF,
i.e., there is no explicit line mark or page mark at the end of the file.
Text_IO can be used to read such non-standard text files but subprograms
to do with line or page numbers do not have defined meanings. In
particular, a FF character that does not follow a LF
character may or may not be treated as a page mark from the point of
view of page and line numbering. Every LF character is considered
to end a line, and there is an implied LF character at the end of
the file.
| • Stream Pointer Positioning: | ||
| • Reading and Writing Non-Regular Files: | ||
| • Get_Immediate: | ||
| • Treating Text_IO Files as Streams: | ||
| • Text_IO Extensions: | ||
| • Text_IO Facilities for Unbounded Strings: | ||
Next: Wide_Text_IO, Previous: Sequential_IO, Up: The Implementation of Standard I/O [Contents][Index]