End-of-Transmission character: Difference between revisions

m
spelling; person
(Fixed up the unix description some)
m (spelling; person)
{{Refimprove|date=August 2008}}In [[telecommunication]], an '''end-of-transmission character''' (EOT) is a [[transmission (telecommunications)|transmission]] [[control character]]. It'sIts intended use is to indicate the conclusion of a transmission that may have included one or more texts and any associated [[message]] headings.<ref name=1037c1996>{{cite web |url=http://www.its.bldrdoc.gov/fs-1037/dir-014/_2015.htm |title=end-of-transmission character (EOT) |work=[[Federal Standard 1037C]] |year=1996}}</ref>
 
An EOT is often used to initiate other functions, such as releasing circuits, disconnecting terminals, or placing receive terminals in a [[standby]] condition.<ref name=1037c1996/> It'sIts most common use today is to cause a [[Unix]] [[tty]] driver to signal [[end of file]] and thus exit programs that are awaiting input.
 
In [[ASCII]] and [[Unicode]], the character with the value 4 is EOT. It can be referred to as control-D, <tt>^D</tt> in [[caret notation]].{{Fact|date=March 2009}}
== Meaning in Unix ==
 
Commonly it is believed{{By whom}} that <tt>^D</tt> is an end-of-file character in [[Unix-like]] systems, similar to the DOS [[control-Z]]. It'sIts actual behavior is to cause the terminal driver to immediately make available any characters in the line buffer, and if the buffer is empty to switch to an end-of-file condition until it is reset. A <tt>^D</tt> in a file does not mean anything.
 
This can be demonstrated with the [[cat (Unix)|cat]] program on [[Unix]]-based operating systems such as [[Linux]]: Run the <code>[[cat (Unix)|cat]]</code> command with no arguments, so that it accepts its input from yourthe keyboard and prints output to yourthe screen. Type a few characters without pressing {{keypress|Enter}}, then type {{keypress|Ctrl}}+{{keypress|D}}. The characters you have typed to that point are sent to cat, which then writes them to the screen. If you type {{keypress|Ctrl}}+{{keypress|D}} without typing any characters first, you terminate the input stream and the program ends. You may be able to get an actual <tt>^D</tt> by typing {{keypress|Ctrl}}+{{keypress|V}} and then {{keypress|Ctrl}}+{{keypress|D}}.
 
If the terminal is in "raw" mode then the <tt>^D</tt> character is sent unchanged to the program, which may decide to interpret it as ending the input. This is similar to how MSDOS works, where programs interpret the <tt>^Z</tt> character as ending the input.