End-of-Transmission character: Difference between revisions

Added missing commas.
m (Bot: HTTP→HTTPS (v485))
m (Added missing commas.)
== Meaning in Unix ==
The EOT character in Unix is different from the [[Control-Z]] in DOS. The DOS Control-Z byte is actually sent and/or placed in files to indicate where the text ends. In contrast, the Control-D causes the Unix terminal driver to signal the [[end-of-file|EOF]] condition, which is not a character, while the byte has no special meaning if actually read or written from a file or terminal.
In Unix, the end-of-file character (by default EOT) causes the terminal driver to make available all characters in its input buffer immediately; normally the driver would collect characters until it sees an end-of-line character. If the input buffer is empty (because no characters have been typed since the last end-of-line or end-of-file), a program reading from the terminal reads a count of zero bytes. In Unix, such a condition is understood as having reached the end of the file.
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}}.