<s>
The	O
C	B-Language
programming	I-Language
language	I-Language
provides	O
many	O
standard	B-Library
library	I-Library
functions	O
for	O
file	B-Operating_System
input	B-General_Concept
and	I-General_Concept
output	I-General_Concept
.	O
</s>
<s>
These	O
functions	O
make	O
up	O
the	O
bulk	O
of	O
the	B-Language
C	I-Language
standard	I-Language
library	I-Language
header	B-Language
.	O
</s>
<s>
The	O
functionality	O
descends	O
from	O
a	O
"	O
portable	O
I/O	B-General_Concept
package	O
"	O
written	O
by	O
Mike	O
Lesk	O
at	O
Bell	O
Labs	O
in	O
the	O
early	O
1970s	O
,	O
and	O
officially	O
became	O
part	O
of	O
the	O
Unix	B-Application
operating	I-Application
system	I-Application
in	O
Version	B-Operating_System
7	I-Operating_System
.	O
</s>
<s>
The	O
I/O	B-General_Concept
functionality	O
of	O
C	B-Language
is	O
fairly	O
low-level	O
by	O
modern	O
standards	O
;	O
C	B-Language
abstracts	O
all	O
file	B-Operating_System
operations	O
into	O
operations	O
on	O
streams	O
of	O
bytes	B-Application
,	O
which	O
may	O
be	O
"	O
input	B-Architecture
streams	I-Architecture
"	O
or	O
"	O
output	O
streams	O
"	O
.	O
</s>
<s>
Unlike	O
some	O
earlier	O
programming	O
languages	O
,	O
C	B-Language
has	O
no	O
direct	O
support	O
for	O
random-access	B-General_Concept
data	O
files	O
;	O
to	O
read	O
from	O
a	O
record	O
in	O
the	O
middle	O
of	O
a	O
file	B-Operating_System
,	O
the	O
programmer	O
must	O
create	O
a	O
stream	B-Architecture
,	O
seek	O
to	O
the	O
middle	O
of	O
the	O
file	B-Operating_System
,	O
and	O
then	O
read	O
bytes	B-Application
in	O
sequence	O
from	O
the	O
stream	B-Architecture
.	O
</s>
<s>
The	O
stream	B-Architecture
model	O
of	O
file	B-Operating_System
I/O	B-General_Concept
was	O
popularized	O
by	O
Unix	B-Application
,	O
which	O
was	O
developed	O
concurrently	O
with	O
the	O
C	B-Language
programming	I-Language
language	I-Language
itself	O
.	O
</s>
<s>
The	O
vast	O
majority	O
of	O
modern	O
operating	O
systems	O
have	O
inherited	O
streams	O
from	O
Unix	B-Application
,	O
and	O
many	O
languages	O
in	O
the	O
C	B-Language
programming	I-Language
language	I-Language
family	O
have	O
inherited	O
C	B-Language
's	O
file	B-Operating_System
I/O	B-General_Concept
interface	I-General_Concept
with	O
few	O
if	O
any	O
changes	O
(	O
for	O
example	O
,	O
PHP	B-Application
)	O
.	O
</s>
<s>
Most	O
of	O
the	O
C	B-Language
file	I-Language
input/output	I-Language
functions	O
are	O
defined	O
in	O
(	O
or	O
in	O
the	O
C++	B-Language
header	B-Language
,	O
which	O
contains	O
the	O
standard	O
C	B-Language
functionality	O
but	O
in	O
the	O
namespace	O
)	O
.	O
</s>
<s>
Constants	O
defined	O
in	O
the	O
header	B-Language
include	O
:	O
</s>
<s>
Variables	O
defined	O
in	O
the	O
header	B-Language
include	O
:	O
</s>
<s>
Name	O
Notes	O
stdin	O
A	O
pointer	O
to	O
a	O
which	O
refers	O
to	O
the	O
standard	O
input	B-Architecture
stream	I-Architecture
,	O
usually	O
a	O
keyboard	O
.	O
</s>
<s>
stdout	O
A	O
pointer	O
to	O
a	O
which	O
refers	O
to	O
the	O
standard	O
output	O
stream	B-Architecture
,	O
usually	O
a	O
display	O
terminal	O
.	O
</s>
<s>
stderr	O
A	O
pointer	O
to	O
a	O
which	O
refers	O
to	O
the	O
standard	O
error	O
stream	B-Architecture
,	O
often	O
a	O
display	O
terminal	O
.	O
</s>
<s>
Data	O
types	O
defined	O
in	O
the	O
header	B-Language
include	O
:	O
</s>
<s>
–	O
also	O
known	O
as	O
a	O
file	B-Application
handle	I-Application
,	O
this	O
is	O
an	O
opaque	O
type	O
containing	O
the	O
information	O
about	O
a	O
file	B-Operating_System
or	O
text	O
stream	B-Architecture
needed	O
to	O
perform	O
input	O
or	O
output	O
operations	O
on	O
it	O
,	O
including	O
:	O
</s>
<s>
The	O
POSIX	O
standard	O
defines	O
several	O
extensions	O
to	O
in	O
its	O
Base	O
Definitions	O
,	O
among	O
which	O
are	O
a	O
function	O
that	O
allocates	O
memory	O
,	O
the	O
and	O
functions	O
that	O
establish	O
the	O
link	O
between	O
objects	O
and	O
file	B-Application
descriptors	I-Application
,	O
and	O
a	O
group	O
of	O
functions	O
for	O
creating	O
objects	O
that	O
refer	O
to	O
in-memory	O
buffers	O
.	O
</s>
<s>
The	O
following	O
C	B-Language
program	I-Language
opens	O
a	O
binary	O
file	B-Operating_System
called	O
myfile	O
,	O
reads	O
five	O
bytes	B-Application
from	O
it	O
,	O
and	O
then	O
closes	O
the	O
file	B-Operating_System
.	O
</s>
<s>
Among	O
these	O
is	O
the	O
C++	B-Language
library	O
,	O
part	O
of	O
the	O
ISO	O
C++	B-Language
standard	O
.	O
</s>
<s>
ISO	O
C++	B-Language
still	O
requires	O
the	O
functionality	O
.	O
</s>
<s>
Other	O
alternatives	O
include	O
the	O
SFIO	O
(	O
A	O
Safe/Fast	O
I/O	B-General_Concept
Library	O
)	O
library	O
from	O
AT&T	O
Bell	O
Laboratories	O
.	O
</s>
<s>
Among	O
its	O
features	O
is	O
the	O
possibility	O
to	O
insert	O
callback	O
functions	O
into	O
a	O
stream	B-Architecture
to	O
customize	O
the	O
handling	O
of	O
data	O
read	O
from	O
or	O
written	O
to	O
the	O
stream	B-Architecture
.	O
</s>
