End-of-Transmission character: Difference between revisions

←Symbol: ; added two references.
(→‎Meaning in Unix: rendering EOT glyph details added)
(←Symbol: ; added two references.)
An EOT is often used to initiate other functions, such as releasing circuits, disconnecting terminals, or placing receive terminals in a [[standby (electricity)|standby]] condition.<ref name=1037c1996/> Its most common use today is to cause a Unix [[computer terminal|terminal]] driver to signal [[end of file]] and thus exit programs that are awaiting input.
In [[ASCII]] and [[Unicode]], the character is encoded at {{unichar|0004|END OF TRANSMISSION}}. It can be referred to as control-{{keypress|Ctrl|D}}, <tt>^D</tt> in [[caret notation]]. Unicode provides the character {{unichar|2404|SYMBOL FOR END OF TRANSMISSION|html=}} for when EOT needs to be displayed graphically.<ref>{{cite web| title = Control Pictures| url = http://www.unicode.org/charts/PDF/U2400.pdf| accessdate = 2013-04-06}}</ref> In addition, {{unichar|2301|ELECTRIC ARROW}} can also be used as a graphic representation of EOT; it is defined in Unicode as "symbol for End of Transmission".<ref>{{cite web
| title = Miscellaneous Technical
| url = http://www.unicode.org/charts/PDF/U2300.pdf
| accessdate = 2013-04-07}}
== Meaning in Unix ==
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}}. The actual unicodeUnicode [[␄]] <!-- if this symbol does not appear as EOT the font used on your computer is faulty ie. ubuntu 12.04 suffers this and also incorrectly displays the ENQ glyph --> character [[glyph]] can be obtained by typing [[Unicode_input#In_X11_.28Linux_and_other_Unix_variants.29|{{keypress|Ctrl|Shift|U}}]] then {{keypress|2}} {{keypress|4}} {{keypress|0}} {{keypress|4}} {{keypress|Enter}}.
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.