End-of-Transmission character: Difference between revisions

This can be demonstrated with the <tt>[[cat (Unix)|cat]]</tt> program on [[Unix]]-based operating systems such as [[Linux]]: Run the <code>cat</code> command with no arguments, so it accepts its input from the keyboard and prints output to the screen. Type a few characters without pressing {{keypress|Enter}}, then type {{keypress|Ctrl|D}}. The characters typed to that point are sent to cat, which then writes them to the screen. If {{keypress|Ctrl|D}} is typed without typing any characters first, the input stream is terminated and the program ends. An actual EOT is obtained by typing {{keypress|Ctrl|V}} then {{keypress|Ctrl|D}}.
If the terminal driver is in "raw" mode, it no longer interprets control characters, and the EOT character is sent unchanged to the program, which is free to interpret it any way it likes. A program may then decide to handle the EOT byte as an indication that it should end the text,; this would then be similar to how {{keypress|Ctrl|Z}} is handled by DOS programs.
== Usage in mainframe computer system communications protocols ==