<Table> <Tr> <Td> </Td> <Td> This section relies largely or entirely on a single source . Relevant discussion may be found on the talk page . Please help improve this article by introducing citations to additional sources . (March 2015) </Td> </Tr> </Table> <Tr> <Td> </Td> <Td> This section relies largely or entirely on a single source . Relevant discussion may be found on the talk page . Please help improve this article by introducing citations to additional sources . (March 2015) </Td> </Tr> <P> Input from a terminal never really "ends" (unless the device is disconnected), but it is useful to enter more than one "file" into a terminal, so a key sequence is reserved to indicate end of input . In UNIX the translation of the keystroke to EOF is performed by the terminal driver, so a program does not need to distinguish terminals from other input files . By default, the driver converts a Control - D character at the start of a line into an end - of - file indicator . To insert an actual Control - D (ASCII 04) character into the input stream, the user precedes it with a "quote" command character (usually Control - V). AmigaDOS is similar but uses Control - \ instead of Control - D . </P> <P> In Microsoft's DOS and Windows (and in CP / M and many DEC operating systems), reading from the terminal will never produce an EOF . Instead, programs recognize that the source is a terminal (or other "character device") and interpret a given reserved character or sequence as an end - of - file indicator; most commonly this is an ASCII Control - Z, code 26 . Some MS - DOS programs, including parts of the Microsoft MS - DOS shell (COMMAND.COM) and operating - system utility programs (such as EDLIN), treat a Control - Z in a text file as marking the end of meaningful data, and / or append a Control - Z to the end when writing a text file . This was done for two reasons: </P>

Locate the end of the file in c