<s>
In	O
computing	O
,	O
end-of-file	B-Language
(	O
EOF	O
)	O
is	O
a	O
condition	O
in	O
a	O
computer	B-General_Concept
operating	I-General_Concept
system	I-General_Concept
where	O
no	O
more	O
data	O
can	O
be	O
read	O
from	O
a	O
data	O
source	O
.	O
</s>
<s>
The	O
data	O
source	O
is	O
usually	O
called	O
a	O
file	B-Operating_System
or	O
stream	B-Architecture
.	O
</s>
<s>
In	O
the	B-Language
C	I-Language
standard	I-Language
library	I-Language
,	O
the	O
character	O
reading	O
functions	O
such	O
as	O
getchar	O
return	O
a	O
value	O
equal	O
to	O
the	O
symbolic	O
value	O
(	O
macro	O
)	O
EOF	O
to	O
indicate	O
that	O
an	O
end-of-file	B-Language
condition	O
has	O
occurred	O
.	O
</s>
<s>
The	O
actual	O
value	O
of	O
EOF	O
is	O
implementation-dependent	O
and	O
must	O
be	O
negative	O
(	O
but	O
is	O
commonly	O
−1	O
,	O
such	O
as	O
in	O
glibc	B-Language
)	O
.	O
</s>
<s>
Block-reading	O
functions	O
return	O
the	O
number	O
of	O
bytes	O
read	O
,	O
and	O
if	O
this	O
is	O
fewer	O
than	O
asked	O
for	O
,	O
then	O
the	O
end	B-Language
of	I-Language
file	I-Language
was	O
reached	O
or	O
an	O
error	O
occurred	O
(	O
checking	O
of	O
errno	B-Error_Name
or	O
dedicated	O
function	O
,	O
such	O
as	O
ferror	O
is	O
required	O
to	O
determine	O
which	O
)	O
.	O
</s>
<s>
Input	O
from	O
a	O
terminal	O
never	O
really	O
"	O
ends	O
"	O
(	O
unless	O
the	O
device	O
is	O
disconnected	O
)	O
,	O
but	O
it	O
is	O
useful	O
to	O
enter	O
more	O
than	O
one	O
"	O
file	B-Operating_System
"	O
into	O
a	O
terminal	O
,	O
so	O
a	O
key	O
sequence	O
is	O
reserved	O
to	O
indicate	O
end	O
of	O
input	O
.	O
</s>
<s>
In	O
UNIX	B-Application
the	O
translation	O
of	O
the	O
keystroke	O
to	O
EOF	O
is	O
performed	O
by	O
the	O
terminal	O
driver	O
,	O
so	O
a	O
program	O
does	O
not	O
need	O
to	O
distinguish	O
terminals	O
from	O
other	O
input	O
files	O
.	O
</s>
<s>
By	O
default	O
,	O
the	O
driver	O
converts	O
a	O
Control-D	O
character	O
at	O
the	O
start	O
of	O
a	O
line	O
into	O
an	O
end-of-file	B-Language
indicator	O
.	O
</s>
<s>
To	O
insert	O
an	O
actual	O
Control-D	O
(	O
ASCII	B-Protocol
04	O
)	O
character	O
into	O
the	O
input	B-Architecture
stream	I-Architecture
,	O
the	O
user	O
precedes	O
it	O
with	O
a	O
"	O
quote	O
"	O
command	O
character	O
(	O
usually	O
Control-V	B-Device
)	O
.	O
</s>
<s>
AmigaDOS	B-Operating_System
is	O
similar	O
but	O
uses	O
Control-	O
\	O
instead	O
of	O
Control-D	O
.	O
</s>
<s>
In	O
DOS	B-Device
and	O
Windows	B-Application
(	O
and	O
in	O
CP/M	B-Application
and	O
many	O
DEC	O
operating	B-General_Concept
systems	I-General_Concept
such	O
as	O
the	O
PDP-6	B-Device
monitor	O
,	O
RT-11	B-Operating_System
,	O
VMS	B-Operating_System
or	O
TOPS-10	B-Operating_System
)	O
,	O
reading	O
from	O
the	O
terminal	O
will	O
never	O
produce	O
an	O
EOF	O
.	O
</s>
<s>
Instead	O
,	O
programs	O
recognize	O
that	O
the	O
source	O
is	O
a	O
terminal	O
(	O
or	O
other	O
"	O
character	O
device	O
"	O
)	O
and	O
interpret	O
a	O
given	O
reserved	O
character	O
or	O
sequence	O
as	O
an	O
end-of-file	B-Language
indicator	O
;	O
most	O
commonly	O
this	O
is	O
an	O
ASCII	B-Protocol
Control-Z	O
,	O
code	O
26	O
.	O
</s>
<s>
Some	O
MS-DOS	O
programs	O
,	O
including	O
parts	O
of	O
the	O
Microsoft	O
MS-DOS	O
shell	O
(	O
COMMAND.COM	B-Operating_System
)	O
and	O
operating-system	O
utility	O
programs	O
(	O
such	O
as	O
EDLIN	B-Application
)	O
,	O
treat	O
a	O
Control-Z	O
in	O
a	O
text	O
file	B-Operating_System
as	O
marking	O
the	O
end	O
of	O
meaningful	O
data	O
,	O
and/or	O
append	O
a	O
Control-Z	O
to	O
the	O
end	O
when	O
writing	O
a	O
text	O
file	B-Operating_System
.	O
</s>
<s>
Backward	O
compatibility	O
with	O
CP/M	B-Application
.	O
</s>
<s>
The	O
CP/M	B-Application
file	B-Application
system	I-Application
(	O
and	O
also	O
the	O
original	O
8-bit	O
FAT	O
implemented	O
in	O
Microsoft	B-Language
BASIC	I-Language
)	O
only	O
recorded	O
the	O
lengths	O
of	O
files	O
in	O
multiples	O
of	O
128-byte	O
"	O
records	O
"	O
,	O
so	O
by	O
convention	O
a	O
Control-Z	O
character	O
was	O
used	O
to	O
mark	O
the	O
end	O
of	O
meaningful	O
data	O
if	O
it	O
ended	O
in	O
the	O
middle	O
of	O
a	O
record	O
.	O
</s>
<s>
The	O
FAT12	B-Application
filesystem	B-Application
introduced	O
with	O
86-DOS	B-Operating_System
and	O
MS-DOS	O
has	O
always	O
recorded	O
the	O
exact	O
byte-length	O
of	O
files	O
,	O
so	O
this	O
was	O
never	O
necessary	O
on	O
DOS	B-Device
.	O
</s>
<s>
It	O
allows	O
programs	O
to	O
use	O
the	O
same	O
code	O
to	O
read	O
input	O
from	O
both	O
a	O
terminal	O
and	O
a	O
text	O
file	B-Operating_System
.	O
</s>
<s>
In	O
the	O
ANSI	O
X3.27-1969	O
magnetic	B-Architecture
tape	I-Architecture
standard	O
,	O
the	O
end	B-Language
of	I-Language
file	I-Language
was	O
indicated	O
by	O
a	O
tape	O
mark	O
,	O
which	O
consisted	O
of	O
a	O
gap	O
of	O
approximately	O
3.5inches	O
of	O
tape	O
followed	O
by	O
a	O
single	O
byte	O
containing	O
the	O
character	O
13	O
(	O
hex	O
)	O
for	O
nine-track	B-Device
tapes	I-Device
and	O
17	O
(	O
octal	O
)	O
for	O
seven-track	B-Device
tapes	I-Device
.	O
</s>
<s>
This	O
was	O
the	O
standard	O
used	O
,	O
for	O
example	O
,	O
on	O
IBM	B-Application
360	I-Application
.	O
</s>
