<s>
In	O
computer	B-General_Concept
programming	I-General_Concept
,	O
standard	B-Operating_System
streams	I-Operating_System
are	O
interconnected	O
input	B-General_Concept
and	I-General_Concept
output	I-General_Concept
communication	O
channels	O
between	O
a	O
computer	O
program	O
and	O
its	O
environment	O
when	O
it	O
begins	O
execution	O
.	O
</s>
<s>
The	O
three	O
input/output	B-General_Concept
(	O
I/O	B-General_Concept
)	O
connections	O
are	O
called	O
standard	O
input	O
(	O
stdin	O
)	O
,	O
standard	O
output	O
(	O
stdout	O
)	O
and	O
standard	O
error	O
(	O
stderr	O
)	O
.	O
</s>
<s>
Originally	O
I/O	B-General_Concept
happened	O
via	O
a	O
physically	O
connected	O
system	B-Device
console	I-Device
(	O
input	O
via	O
keyboard	B-Device
,	O
output	O
via	O
monitor	O
)	O
,	O
but	O
standard	B-Operating_System
streams	I-Operating_System
abstract	O
this	O
.	O
</s>
<s>
When	O
a	O
command	O
is	O
executed	O
via	O
an	O
interactive	O
shell	B-Operating_System
,	O
the	O
streams	O
are	O
typically	O
connected	O
to	O
the	O
text	O
terminal	O
on	O
which	O
the	O
shell	B-Operating_System
is	O
running	O
,	O
but	O
can	O
be	O
changed	O
with	O
redirection	B-Device
or	O
a	O
pipeline	B-Operating_System
.	O
</s>
<s>
More	B-Device
generally	O
,	O
a	O
child	B-Operating_System
process	I-Operating_System
inherits	O
the	O
standard	B-Operating_System
streams	I-Operating_System
of	O
its	O
parent	B-Operating_System
process	I-Operating_System
.	O
</s>
<s>
Users	O
generally	O
know	O
standard	B-Operating_System
streams	I-Operating_System
as	O
input	B-General_Concept
and	I-General_Concept
output	I-General_Concept
channels	O
that	O
handle	O
data	O
coming	O
from	O
an	O
input	O
device	O
,	O
or	O
that	O
write	O
data	O
from	O
the	O
application	O
.	O
</s>
<s>
In	O
many	O
modern	O
systems	O
,	O
the	O
standard	O
error	O
stream	O
of	O
a	O
program	O
is	O
redirected	B-Device
into	O
a	O
log	O
file	O
,	O
typically	O
for	O
error	O
analysis	O
purposes	O
.	O
</s>
<s>
Streams	O
may	O
be	O
used	O
to	O
chain	O
applications	O
,	O
meaning	O
that	O
the	O
output	O
stream	O
of	O
one	O
program	O
can	O
be	O
redirected	B-Device
to	O
be	O
the	O
input	B-Architecture
stream	I-Architecture
to	O
another	O
application	O
.	O
</s>
<s>
In	O
many	O
operating	O
systems	O
this	O
is	O
expressed	O
by	O
listing	O
the	O
application	O
names	O
,	O
separated	O
by	O
the	O
vertical	O
bar	O
character	O
,	O
for	O
this	O
reason	O
often	O
called	O
the	O
pipeline	B-Operating_System
character	O
.	O
</s>
<s>
A	O
well-known	O
example	O
is	O
the	O
use	O
of	O
a	O
pagination	O
application	O
,	O
such	O
as	O
more	B-Device
,	O
providing	O
the	O
user	O
control	O
over	O
the	O
display	O
of	O
the	O
output	O
stream	O
on	O
the	O
display	O
.	O
</s>
<s>
In	O
most	O
operating	O
systems	O
predating	O
Unix	B-Application
,	O
programs	O
had	O
to	O
explicitly	O
connect	O
to	O
the	O
appropriate	O
input	B-General_Concept
and	I-General_Concept
output	I-General_Concept
devices	O
.	O
</s>
<s>
On	O
many	O
systems	O
it	O
was	O
necessary	O
to	O
obtain	O
control	O
of	O
environment	O
settings	O
,	O
access	O
a	O
local	O
file	O
table	O
,	O
determine	O
the	O
intended	O
data	O
set	O
,	O
and	O
handle	O
hardware	O
correctly	O
in	O
the	O
case	O
of	O
a	O
punch	B-Device
card	I-Device
reader	I-Device
,	O
magnetic	O
tape	O
drive	O
,	O
disk	B-Device
drive	I-Device
,	O
line	O
printer	O
,	O
card	B-Device
punch	I-Device
,	O
or	O
interactive	O
terminal	O
.	O
</s>
<s>
One	O
of	O
Unix	B-Application
's	O
several	O
groundbreaking	O
advances	O
was	O
abstract	O
devices	O
,	O
which	O
removed	O
the	O
need	O
for	O
a	O
program	O
to	O
know	O
or	O
care	O
what	O
kind	O
of	O
devices	O
it	O
was	O
communicating	O
with	O
.	O
</s>
<s>
Unix	B-Application
eliminated	O
this	O
complexity	O
with	O
the	O
concept	O
of	O
a	O
data	O
stream	O
:	O
an	O
ordered	O
sequence	O
of	O
data	O
bytes	O
which	O
can	O
be	O
read	O
until	O
the	O
end	B-Language
of	I-Language
file	I-Language
.	O
</s>
<s>
Another	O
Unix	B-Application
breakthrough	O
was	O
to	O
automatically	O
associate	O
input	B-General_Concept
and	I-General_Concept
output	I-General_Concept
to	O
terminal	O
keyboard	B-Device
and	O
terminal	O
display	O
,	O
respectively	O
,	O
by	O
default	O
—	O
the	O
program	O
(	O
and	O
programmer	O
)	O
did	O
absolutely	O
nothing	O
to	O
establish	O
input	B-General_Concept
and	I-General_Concept
output	I-General_Concept
for	O
a	O
typical	O
input-process-output	O
program	O
(	O
unless	O
it	O
chose	O
a	O
different	O
paradigm	O
)	O
.	O
</s>
<s>
In	O
contrast	O
,	O
previous	O
operating	O
systems	O
usually	O
required	O
some	O
—	O
often	O
complex	O
—	O
job	B-Application
control	I-Application
language	I-Application
to	O
establish	O
connections	O
,	O
or	O
the	O
equivalent	O
burden	O
had	O
to	O
be	O
orchestrated	O
by	O
the	O
program	O
.	O
</s>
<s>
Since	O
Unix	B-Application
provided	O
standard	B-Operating_System
streams	I-Operating_System
,	O
the	O
Unix	B-Application
C	B-Language
runtime	O
environment	O
was	O
obliged	O
to	O
support	O
it	O
as	O
well	O
.	O
</s>
<s>
As	O
a	O
result	O
,	O
most	O
C	B-Language
runtime	O
environments	O
(	O
and	O
C	B-Language
's	O
descendants	O
)	O
,	O
regardless	O
of	O
the	O
operating	O
system	O
,	O
provide	O
equivalent	O
functionality	O
.	O
</s>
<s>
Standard	O
input	O
is	O
a	O
stream	O
from	O
which	O
a	O
program	O
reads	O
its	O
input	B-General_Concept
data	I-General_Concept
.	O
</s>
<s>
For	O
example	O
,	O
the	O
dir	B-Application
and	O
ls	B-Application
programs	O
(	O
which	O
display	O
file	O
names	O
contained	O
in	O
a	O
directory	O
)	O
may	O
take	O
command-line	O
arguments	O
,	O
but	O
perform	O
their	O
operations	O
without	O
any	O
stream	O
data	O
input	O
.	O
</s>
<s>
Unless	O
redirected	B-Device
,	O
standard	O
input	O
is	O
inherited	O
from	O
the	O
parent	B-Operating_System
process	I-Operating_System
.	O
</s>
<s>
In	O
the	O
case	O
of	O
an	O
interactive	O
shell	B-Operating_System
,	O
that	O
is	O
usually	O
associated	O
with	O
the	O
keyboard	B-Device
.	O
</s>
<s>
The	O
file	B-Application
descriptor	I-Application
for	O
standard	O
input	O
is	O
0	O
(	O
zero	O
)	O
;	O
the	O
POSIX	O
<unistd.h> definition is STDIN_FILENO; the corresponding C <stdio.h> variable is FILE* stdin; similarly, the C++ <iostream>	O
variable	O
is	O
std::cin	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
file	B-General_Concept
rename	I-General_Concept
command	O
(	O
variously	O
called	O
mv	O
,	O
move	B-Device
,	O
or	O
ren	B-Device
)	O
is	O
silent	O
on	O
success	O
.	O
</s>
<s>
Unless	O
redirected	B-Device
,	O
standard	O
output	O
is	O
inherited	O
from	O
the	O
parent	B-Operating_System
process	I-Operating_System
.	O
</s>
<s>
In	O
the	O
case	O
of	O
an	O
interactive	O
shell	B-Operating_System
,	O
that	O
is	O
usually	O
the	O
text	O
terminal	O
which	O
initiated	O
the	O
program	O
.	O
</s>
<s>
The	O
file	B-Application
descriptor	I-Application
for	O
standard	O
output	O
is	O
1	O
(	O
one	O
)	O
;	O
the	O
POSIX	O
<unistd.h> definition is STDOUT_FILENO; the corresponding C <stdio.h> variable is FILE* stdout; similarly, the C++ <iostream>	O
variable	O
is	O
std::cout	O
.	O
</s>
<s>
Standard	O
error	O
is	O
another	O
output	O
stream	O
typically	O
used	O
by	O
programs	O
to	O
output	O
error	B-Error_Name
messages	I-Error_Name
or	O
diagnostics	O
.	O
</s>
<s>
It	O
is	O
a	O
stream	O
independent	O
of	O
standard	O
output	O
and	O
can	O
be	O
redirected	B-Device
separately	O
.	O
</s>
<s>
The	O
usual	O
destination	O
is	O
the	O
text	O
terminal	O
which	O
started	O
the	O
program	O
to	O
provide	O
the	O
best	O
chance	O
of	O
being	O
seen	O
even	O
if	O
standard	O
output	O
is	O
redirected	B-Device
(	O
so	O
not	O
readily	O
observed	O
)	O
.	O
</s>
<s>
For	O
example	O
,	O
output	O
of	O
a	O
program	O
in	O
a	O
pipeline	B-Operating_System
is	O
redirected	B-Device
to	O
input	O
of	O
the	O
next	O
program	O
or	O
a	O
text	O
file	O
,	O
but	O
errors	O
from	O
each	O
program	O
still	O
go	O
directly	O
to	O
the	O
text	O
terminal	O
so	O
they	O
can	O
be	O
reviewed	O
by	O
the	O
user	O
in	O
real	O
time	O
.	O
</s>
<s>
Messages	O
appear	O
in	O
the	O
same	O
order	O
as	O
the	O
program	O
writes	O
them	O
,	O
unless	O
buffering	B-General_Concept
is	O
involved	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
common	O
situations	O
the	O
standard	O
error	O
stream	O
is	O
unbuffered	O
but	O
the	O
standard	O
output	O
stream	O
is	O
line-buffered	O
;	O
in	O
this	O
case	O
,	O
text	O
written	O
to	O
standard	O
error	O
later	O
may	O
appear	O
on	O
the	O
terminal	O
earlier	O
,	O
if	O
the	O
standard	O
output	O
stream	O
buffer	B-General_Concept
is	O
not	O
yet	O
full	O
.	O
</s>
<s>
The	O
file	B-Application
descriptor	I-Application
for	O
standard	O
error	O
is	O
defined	O
by	O
POSIX	O
as	O
2	O
(	O
two	O
)	O
;	O
the	O
<unistd.h> header file provides the symbol STDERR_FILENO; the corresponding C <stdio.h>	O
variable	O
is	O
FILE*	O
stderr	O
.	O
</s>
<s>
The	O
C++	O
<iostream>	O
standard	O
header	O
provides	O
two	O
variables	O
associated	O
with	O
this	O
stream	O
:	O
std::cerr	O
and	O
std::clog	O
,	O
the	O
former	O
being	O
unbuffered	O
and	O
the	O
latter	O
using	O
the	O
same	O
buffering	B-General_Concept
mechanism	O
as	O
all	O
other	O
C++	O
streams	O
.	O
</s>
<s>
Standard	O
error	O
was	O
added	O
to	O
Unix	B-Application
in	O
the	O
1970s	O
after	O
several	O
wasted	O
phototypesetting	O
runs	O
ended	O
with	O
error	B-Error_Name
messages	I-Error_Name
being	O
typeset	O
instead	O
of	O
displayed	O
on	O
the	O
user	O
's	O
terminal	O
.	O
</s>
<s>
Fortran	B-Application
has	O
the	O
equivalent	O
of	O
Unix	B-Application
file	B-Application
descriptors	I-Application
:	O
By	O
convention	O
,	O
many	O
Fortran	B-Application
implementations	O
use	O
unit	O
numbers	O
UNIT	O
=	O
5	O
for	O
stdin	O
,	O
UNIT	O
=	O
6	O
for	O
stdout	O
and	O
UNIT	O
=	O
0	O
for	O
stderr	O
.	O
</s>
<s>
In	O
Fortran-2003	O
,	O
the	O
intrinsic	O
ISO_FORTRAN_ENV	O
module	O
was	O
standardized	O
to	O
include	O
the	O
named	O
constants	O
INPUT_UNIT	O
,	O
OUTPUT_UNIT	O
,	O
and	O
ERROR_UNIT	O
to	O
portably	O
specify	O
the	O
unit	O
numbers	O
.	O
</s>
<s>
ALGOL	B-Language
60	I-Language
was	O
criticized	O
for	O
having	O
no	O
standard	O
file	O
access	O
.	O
</s>
<s>
ALGOL	B-Language
68	I-Language
's	O
input	B-General_Concept
and	I-General_Concept
output	I-General_Concept
facilities	O
were	O
collectively	O
referred	O
to	O
as	O
the	O
transput	B-General_Concept
.	O
</s>
<s>
Koster	O
coordinated	O
the	O
definition	O
of	O
the	O
transput	B-General_Concept
standard	O
.	O
</s>
<s>
The	O
model	O
included	O
three	O
standard	B-Operating_System
channels	I-Operating_System
:	O
stand	O
in	O
,	O
stand	O
out	O
,	O
and	O
stand	O
back	O
.	O
</s>
<s>
In	O
the	O
C	B-Language
programming	I-Language
language	I-Language
,	O
the	O
standard	O
input	O
,	O
output	O
,	O
and	O
error	O
streams	O
are	O
attached	O
to	O
the	O
existing	O
Unix	B-Application
file	B-Application
descriptors	I-Application
0	O
,	O
1	O
and	O
2	O
respectively	O
.	O
</s>
<s>
In	O
a	O
POSIX	O
environment	O
the	O
<unistd.h>	O
definitions	O
STDIN_FILENO	O
,	O
STDOUT_FILENO	O
or	O
STDERR_FILENO	O
should	O
be	O
used	O
instead	O
rather	O
than	O
magic	O
numbers	O
.	O
</s>
<s>
File	B-Language
pointers	I-Language
stdin	O
,	O
stdout	O
,	O
and	O
stderr	O
are	O
also	O
provided	O
.	O
</s>
<s>
Ken	O
Thompson	O
(	O
designer	O
and	O
implementer	O
of	O
the	O
original	O
Unix	B-Application
operating	I-Application
system	I-Application
)	O
modified	O
sort	B-Application
in	O
Version	B-Operating_System
5	I-Operating_System
Unix	I-Operating_System
to	O
accept	O
"	O
-	O
"	O
as	O
representing	O
standard	O
input	O
,	O
which	O
spread	O
to	O
other	O
utilities	O
and	O
became	O
a	O
part	O
of	O
the	O
operating	O
system	O
as	O
a	O
special	B-Application
file	I-Application
in	O
Version	B-Operating_System
8	I-Operating_System
.	O
</s>
<s>
Diagnostics	O
were	O
part	O
of	O
standard	O
output	O
through	O
Version	B-Operating_System
6	I-Operating_System
,	O
after	O
which	O
Dennis	O
M	O
.	O
Ritchie	O
created	O
the	O
concept	O
of	O
standard	O
error	O
.	O
</s>
<s>
In	O
Java	B-Language
,	O
the	O
standard	B-Operating_System
streams	I-Operating_System
are	O
referred	O
to	O
by	O
(	O
for	O
stdin	O
)	O
,	O
(	O
for	O
stdout	O
)	O
,	O
and	O
(	O
for	O
stderr	O
)	O
.	O
</s>
<s>
In	O
C#	B-Application
and	O
other	O
.NET	B-Application
languages	O
,	O
the	O
standard	B-Operating_System
streams	I-Operating_System
are	O
referred	O
to	O
by	O
System.Console.In	O
(	O
for	O
stdin	O
)	O
,	O
System.Console.Out	O
(	O
for	O
stdout	O
)	O
and	O
System.Console.Error	O
(	O
for	O
stderr	O
)	O
.	O
</s>
<s>
Basic	O
read	O
and	O
write	O
capabilities	O
for	O
the	O
stdin	B-Operating_System
and	I-Operating_System
stdout	I-Operating_System
streams	O
are	O
also	O
accessible	O
directly	O
through	O
the	O
class	O
System.Console	O
(	O
e.g.	O
</s>
<s>
System.Console.In	O
,	O
System.Console.Out	O
and	O
System.Console.Error	O
are	O
System.IO.TextReader	O
(	O
stdin	O
)	O
and	O
System.IO.TextWriter	O
(	O
stdout	O
,	O
stderr	O
)	O
objects	O
,	O
which	O
only	O
allow	O
access	O
to	O
the	O
underlying	O
standard	B-Operating_System
streams	I-Operating_System
on	O
a	O
text	O
basis	O
.	O
</s>
<s>
Full	O
binary	O
access	O
to	O
the	O
standard	B-Operating_System
streams	I-Operating_System
must	O
be	O
performed	O
through	O
the	O
System.IO.Stream	O
objects	O
returned	O
by	O
System.Console.OpenStandardInput( )	O
,	O
System.Console.OpenStandardOutput( )	O
and	O
System.Console.OpenStandardError( )	O
respectively	O
.	O
</s>
<s>
When	O
applying	O
the	O
System.Diagnostics.Process	O
class	O
one	O
can	O
use	O
the	O
instance	O
properties	B-Language
StandardInput	O
,	O
StandardOutput	O
,	O
and	O
StandardError	O
of	O
that	O
class	O
to	O
access	O
the	O
standard	B-Operating_System
streams	I-Operating_System
of	O
the	O
process	O
.	O
</s>
<s>
Graphical	B-Application
user	I-Application
interfaces	I-Application
(	O
GUIs	B-Application
)	O
do	O
n't	O
always	O
make	O
use	O
of	O
the	O
standard	B-Operating_System
streams	I-Operating_System
;	O
they	O
do	O
when	O
GUIs	B-Application
are	O
wrappers	O
of	O
underlying	O
scripts	O
and/or	O
console	O
programs	O
,	O
for	O
instance	O
the	O
Synaptic	B-Language
package	I-Language
manager	I-Language
GUI	B-Application
,	O
which	O
wraps	O
apt	O
commands	O
in	O
Debian	O
and/or	O
Ubuntu	O
.	O
</s>
<s>
GUIs	B-Application
created	O
with	O
scripting	O
tools	O
like	O
Zenity	O
and	O
KDialog	O
by	O
KDE	B-Application
project	O
make	O
use	O
of	O
stdin	O
,	O
stdout	O
,	O
and	O
stderr	O
,	O
and	O
are	O
based	O
on	O
simple	O
scripts	O
rather	O
than	O
a	O
complete	O
GUI	B-Application
programmed	O
and	O
compiled	O
in	O
C/C	O
++	O
using	O
Qt	B-Language
,	O
GTK	B-Application
,	O
or	O
other	O
equivalent	O
proprietary	O
widget	O
framework	O
.	O
</s>
<s>
The	O
Services	O
menu	O
,	O
as	O
implemented	O
on	O
NeXTSTEP	B-Application
and	O
Mac	B-Operating_System
OS	I-Operating_System
X	I-Operating_System
,	O
is	O
also	O
analogous	O
to	O
standard	B-Operating_System
streams	I-Operating_System
.	O
</s>
<s>
On	O
these	O
operating	O
systems	O
,	O
graphical	O
applications	O
can	O
provide	O
functionality	O
through	O
a	O
system-wide	O
menu	O
that	O
operates	O
on	O
the	O
current	O
selection	O
in	O
the	O
GUI	B-Application
,	O
no	O
matter	O
in	O
what	O
application	O
.	O
</s>
<s>
Some	O
GUI	B-Application
programs	O
,	O
primarily	O
on	O
Unix	B-Application
,	O
still	O
write	O
debug	O
information	O
to	O
standard	O
error	O
.	O
</s>
<s>
Others	O
(	O
such	O
as	O
many	O
Unix	B-Application
media	O
players	O
)	O
may	O
read	O
files	O
from	O
standard	O
input	O
.	O
</s>
<s>
Popular	O
Windows	O
programs	O
that	O
open	O
a	O
separate	O
console	O
window	O
in	O
addition	O
to	O
their	O
GUI	B-Application
windows	O
are	O
the	O
emulators	O
pSX	O
and	O
DOSBox	B-Application
.	O
</s>
<s>
GTK-server	B-Language
can	O
use	O
stdin	O
as	O
a	O
communication	O
interface	O
with	O
an	O
interpreted	O
program	O
to	O
realize	O
a	O
GUI	B-Application
.	O
</s>
<s>
The	O
Common	B-Language
Lisp	I-Language
Interface	I-Language
Manager	I-Language
paradigm	O
"	O
presents	O
"	O
GUI	B-Application
elements	O
sent	O
to	O
an	O
extended	O
output	O
stream	O
.	O
</s>
