ℹ️ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0.3 months ago (distributed domain, exempt) |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://en.wikipedia.org/wiki/Standard_streams |
| Last Crawled | 2026-04-03 21:08:55 (10 days ago) |
| First Indexed | 2013-08-08 17:56:11 (12 years ago) |
| HTTP Status Code | 200 |
| Meta Title | Standard streams - Wikipedia |
| Meta Description | null |
| Meta Canonical | null |
| Boilerpipe Text | This article is about standard I/O file descriptors. For System V streams, see
STREAMS
.
In
computer programming
,
standard streams
are preconnected input and output
communication channels
[
1
]
between a computer program and its environment when it begins execution. The three
input/output
(I/O) connections are called
standard input
(
stdin
),
standard output
(
stdout
) and
standard error
(
stderr
). Originally I/O happened via a physically connected
system console
(input via keyboard, output via monitor), but standard streams abstract this. When a command is executed via an interactive
shell
, the streams are typically connected to the
text terminal
on which the shell is running, but can be changed with
redirection
or a
pipeline
. More generally, a
child process
inherits the standard streams of its
parent process
.
The standard streams for input, output, and error in a common default configuration
Users generally know standard streams as input and output channels that handle data coming from an input device, or that write data from the application. The data may be text with any encoding, or
binary data
.
When a program is run as a
daemon
, its standard error stream is redirected into a log file, typically for error analysis purposes.
Streams may be used to chain applications, meaning that the output stream of one program can be redirected to be the input stream to another application. In many operating systems this is expressed by listing the application names, separated by the vertical bar character, for this reason often called the
pipeline
character. A well-known example is the use of a
pagination
application, such as
more
, providing the user control over the display of the output stream on the display.
In most operating systems predating
Unix
, programs had to explicitly connect to the appropriate input and output devices. OS-specific intricacies caused this to be a tedious programming task. On many systems it was necessary to obtain control of environment settings, access a local file table, determine the intended data set, and handle hardware correctly in the case of a
punch card reader
,
magnetic tape drive
,
disk drive
,
line printer
, card punch, or interactive terminal.
One of Unix's several groundbreaking advances was
abstract devices
, which removed the need for a program to know or care what kind of devices it was communicating with
[
citation needed
]
. Older operating systems forced upon the programmer a record structure and frequently
non-orthogonal
data semantics and device control. Unix eliminated this complexity with the concept of a data stream: an ordered sequence of data bytes which can be read until the
end of file
. A program may also write bytes as desired and need not, and cannot easily declare their count or grouping.
Another Unix breakthrough was to automatically associate input and output to terminal keyboard and terminal display, respectively, by default
[
citation needed
]
— the program (and programmer) did absolutely nothing to establish input and output for a typical input-process-output program (unless it chose a different paradigm). In contrast, previous operating systems usually required some—often complex—
job control language
to establish connections, or the equivalent burden had to be orchestrated by the program.
[
citation needed
]
Since Unix provided standard streams, the Unix
C
runtime environment was obliged to support it as well. As a result, most C runtime environments (and
C's descendants
), regardless of the operating system, provide equivalent functionality.
Standard input (stdin)
[
edit
]
Standard input is a stream from which a program reads its input data. The program requests data transfers by use of the
read
operation. Not all programs require stream input. For example, the
dir
and
ls
programs (which display file names contained in a directory) may take
command-line arguments
, but perform their operations without any stream data input.
Unless
redirected
, standard input is inherited from the parent process. In the case of an interactive shell, that is usually associated with the input device of a
terminal
(or
pseudo terminal
) which is ultimately linked to a user's
keyboard
.
On
POSIX
systems, the
file descriptor
for standard input is 0 (zero); the
POSIX
<unistd.h>
definition is
STDIN_FILENO
; the corresponding C
<stdio.h>
abstraction is provided via the
stdin
(of type
FILE*
) global variable. Similarly in
C++
, the global object
std::cin
(of type
std::istream
). provided in
<iostream>
, provides an abstraction via
C++ streams
. Similar abstractions exist in the standard I/O libraries of practically every
programming language
.
Standard output (stdout)
[
edit
]
Standard output is a stream to which a program writes its output data. The program requests data transfer with the
write
operation. Not all programs generate output. For example, the
file rename
command (variously called
mv
,
move
, or
ren
) is silent on success.
Unless
redirected
, standard output is inherited from the parent process. In the case of an interactive shell, that is usually the
text terminal
which initiated the program.
The
file descriptor
for standard output is 1 (one); the
POSIX
<unistd.h>
definition is
STDOUT_FILENO
; the corresponding C
<stdio.h>
variable is
stdout
(of type
FILE*
); similarly in C++, the global object
std::cout
(of type
std::ostream
), provided in
<iostream>
, abstracts the output stream.
Standard error (stderr)
[
edit
]
Standard error is another output stream typically used by programs to output
error messages
or diagnostics. It is a stream independent of standard output and can be redirected separately.
This solves the
semi-predicate problem
, allowing output and errors to be distinguished, and is analogous to a function returning a pair of values – see
Semipredicate problem § Multivalued return
. The usual destination is the
text terminal
which started the program to provide the best chance of being seen even if
standard output
is redirected (so not readily observed). For example, output of a program in a
pipeline
is redirected to input of the next program or a text file, but user prompts and errors from each program still go directly to the text terminal so they can be reviewed by the user in real time.
It is acceptable and normal to direct
standard output
and
standard error
to the same destination, such as the text terminal. Messages appear in the same order as the program writes them, unless
buffering
is involved. For example, in common situations the standard error stream is unbuffered but the standard output stream is line-buffered; in this case, text written to standard error later may appear on the terminal earlier, if the standard output stream buffer is not yet full.
The
file descriptor
for standard error is defined by
POSIX
as 2 (two); the
<unistd.h>
header file provides the symbol
STDERR_FILENO
;
[
2
]
the corresponding C
<stdio.h>
variable is
stderr
(of type
FILE*
). Similarly, C++ provides two global objects associated with this stream:
std::cerr
and
std::clog
(each of type
std::ostream
), in
<iostream>
, with the former being unbuffered and the latter using the same buffering mechanism as all other C++ streams.
Bourne
-style shells allow
standard error
to be redirected to the same destination that standard output is directed to using
2>&1
csh
-style shells allow
standard error
to be redirected to the same destination that standard output is directed to using
>&
Standard error was added to Unix in the 1970s after several wasted phototypesetting runs ended with error messages being typeset instead of displayed on the user's terminal.
[
3
]
Fortran
has the equivalent of Unix file descriptors: By convention, many Fortran implementations use unit numbers
UNIT=5
for stdin,
UNIT=6
for stdout and
UNIT=0
for stderr. In Fortran-2003, the intrinsic
ISO_FORTRAN_ENV
module was standardized to include the named constants
INPUT_UNIT
,
OUTPUT_UNIT
, and
ERROR_UNIT
to portably specify the unit numbers.
! FORTRAN 77 example
PROGRAM
MAIN
INTEGER
NUMBER
READ
(
UNIT
=
5
,
*
)
NUMBER
WRITE
(
UNIT
=
6
,
'(A,I3)'
)
' NUMBER IS: '
,
NUMBER
END
! Fortran 2003 example
program
main
use
iso_fortran_env
implicit none
integer
::
number
read
(
unit
=
INPUT_UNIT
,
*
)
number
write
(
unit
=
OUTPUT_UNIT
,
'(a,i3)'
)
'Number is: '
,
number
end program
ALGOL 60
was criticized for having no standard file access.
[
citation needed
]
ALGOL 68
's input and output facilities were collectively referred to as the transput.
[
4
]
Koster
coordinated the definition of the
transput
standard. The model included three standard channels:
stand in
,
stand out
, and
stand back
.
Example
# ALGOL 68 example #
main:(
REAL number;
getf(stand in,($g$,number));
printf(($"Number is: "g(6,4)"OR "$,number)); # OR #
putf(stand out,($" Number is: "g(6,4)"!"$,number));
newline(stand out)
)
Input:
Output:
3.14159
Number is: +3.142 OR Number is: +3.142!
An other example is the OOP language.
[
5
]
: 11
class
BASICIO
(
LINELENGTH
)
;
integer
LINELENGTH
;
begin
ref
(
infile
)
SYSIN
;
ref
(
infile
)
procedure
sysin
;
sysin
:-
SYSIN
;
ref
(
printfle
)
SYSOUT
;
ref
(
printfle
)
procedure
sysout
;
sysout
:-
SYSOUT
;
class
FILE
....................;
FILE
class
infile
............;
FILE
class
outfile
...........;
FILE
class
directfile
........;
outfile
class
printfle
.......;
SYSIN
:-
new
infile
(
"
SYSIN
"
)
;
SYSOUT
:-
new
printfle
(
"
SYSOUT
"
)
;
SYSIN
.
open
(
blanks
(
80
))
;
SYSOUT
.
open
(
blanks
(
LINELENGTH
))
;
inner
;
SYSIN
.
close
;
SYSOUT
.
close
;
end
BASICIO
;
In the
C programming language
, the standard input, output, and error streams are attached to the existing Unix file descriptors 0, 1 and 2 respectively.
[
6
]
In a
POSIX
environment the
<
unistd.h
>
definitions
STDIN_FILENO
,
STDOUT_FILENO
or
STDERR_FILENO
should be used instead rather than
magic numbers
. File pointers
stdin
,
stdout
, and
stderr
are also provided.
Ken Thompson
(designer and implementer of the original Unix operating system) modified
sort
in
Version 5 Unix
to accept "-" as representing standard input, which spread to other utilities and became a part of the operating system as a
special file
in
Version 8
. Diagnostics were part of standard output through
Version 6
, after which
Dennis M. Ritchie
created the concept of standard error.
[
7
]
In
C++
, writing to standard streams was originally done using the
<iostream>
header and its streams, until the release of
<print>
which simplified input/output using print functions.
[
8
]
C++ inherits
C I/O facilities
, but it is considered more idiomatic to use the newer C++ facilities.
[
9
]
#include
<iostream>
#include
<string>
using
std
::
cerr
;
using
std
::
cin
;
using
std
::
cout
;
using
std
::
endl
;
using
std
::
string
;
int
main
()
{
string
input
;
cout
<<
"Write a sentence: "
<<
endl
;
cin
>>
input
;
int
inputLength
=
input
.
length
();
cout
<<
"Sentence: "
<<
input
<<
", of length "
<<
inputLength
<<
endl
;
cerr
<<
"Sentence written to stderr: "
<<
input
<<
endl
;
}
In
Java
, the standard streams are referred to by
System.in
(for stdin),
System.out
(for stdout), and
System.err
(for stderr).
[
10
]
It is also possible to read from any input stream using a
Scanner
.
package
org.wikipedia.examples
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
public
class
Example
{
public
static
void
main
(
String
args
[]
)
{
try
{
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
System
.
in
));
String
s
=
br
.
readLine
();
double
number
=
Double
.
parseDouble
(
s
);
System
.
out
.
printf
(
"Number is: %d%n"
,
number
);
// Read input for a name and age:
Scanner
input
=
new
Scanner
(
System
.
in
);
System
.
out
.
printf
(
"%nEnter name: "
);
String
name
=
input
.
nextLine
();
System
.
out
.
printf
(
"%nEnter age: "
);
int
age
=
input
.
nextInt
();
System
.
out
.
printf
(
"Hello, %s! You are %d years old."
,
name
,
age
);
}
catch
(
IOException
e
)
{
System
.
err
.
printf
(
"Error in input/output: %s%n"
,
e
.
getMessage
());
}
catch
(
Exception
e
)
{
System
.
err
.
printf
(
"Error: %s%n"
,
e
.
getMessage
());
}
}
}
In
C#
and other
.NET
languages, the standard streams are referred to by
System.Console.In
(for stdin),
System.Console.Out
(for stdout) and
System.Console.Error
(for stderr).
[
11
]
Basic read and write capabilities for the stdin and stdout streams are also accessible directly through the class
System.Console
(e.g.
System.Console.WriteLine()
can be used instead of
System.Console.Out.WriteLine()
).
System.Console.In
,
System.Console.Out
and
System.Console.Error
are respectively
System.IO.TextReader
(stdin) and
System.IO.TextWriter
(stdout, stderr) objects, which only allow access to the underlying standard streams on a text basis. Full binary access to the standard streams must be performed through the
System.IO.Stream
objects returned by
System.Console.OpenStandardInput()
,
System.Console.OpenStandardOutput()
and
System.Console.OpenStandardError()
respectively.
namespace
Wikipeda.Examples
;
using
System
;
public
class
Example
{
static
int
Main
(
string
[]
args
)
{
try
{
string
s
=
Console
.
In
.
ReadLine
();
double
number
=
Double
.
Parse
(
s
);
Console
.
Out
.
WriteLine
(
"Number is: {0:F3}"
,
number
);
}
// If Parse() threw an exception
catch
(
ArgumentNullException
e
)
{
Console
.
Error
.
WriteLine
(
$"No number was entered: {e.Message}"
);
return
1
;
}
catch
(
FormatException
e
)
{
Console
.
Error
.
WriteLine
(
$"The specified value is not a valid number: {e.Message}"
);
return
2
;
}
catch
(
OverflowException
e
)
{
Console
.
Error
.
WriteLine
(
$"The specified number is too big: {e.Message}"
);
return
3
;
}
catch
(
Exception
ex
)
{
Console
.
Error
.
WriteLine
(
$"An unknown exception occurred: {e.Message}"
);
return
-
1
;
}
return
0
;
}
' Visual Basic .NET example
Public
Function
Main
()
As
Integer
Try
Dim
s
As
String
=
System
.
Console
.
[
In
]
.
ReadLine
()
Dim
number
As
Double
=
Double
.
Parse
(
s
)
System
.
Console
.
Out
.
WriteLine
(
"Number is: {0:F3}"
,
number
)
Return
0
' If Parse() threw an exception
Catch
ex
As
System
.
ArgumentNullException
System
.
Console
.
[
Error
]
.
WriteLine
(
"No number was entered!"
)
Catch
ex2
As
System
.
FormatException
System
.
Console
.
[
Error
]
.
WriteLine
(
"The specified value is not a valid number!"
)
Catch
ex3
As
System
.
OverflowException
System
.
Console
.
[
Error
]
.
WriteLine
(
"The specified number is too big!"
)
End
Try
Return
-
1
End
Function
When applying the
System.Diagnostics.Process
class
one can use the instance
properties
StandardInput
,
StandardOutput
, and
StandardError
of that class to access the standard streams of the process.
2000s onward: Python, C++
[
edit
]
The following example, written in
Python
, shows how to redirect the standard input both to the standard output
and to a text file.
#!/usr/bin/env python
import
sys
from
typing
import
TextIO
if
__name__
==
"__main__"
:
# Save the current stdout so that we can revert sys.stdout
# after we complete our redirection
stdin_fileno
:
TextIO
=
sys
.
stdin
stdout_fileno
:
TextIO
=
sys
.
stdout
# Redirect sys.stdout to the file
sys
.
stdout
:
TextIO
=
open
(
"myfile.txt"
,
"w"
)
ctr
:
int
=
0
for
inps
in
stdin_fileno
:
ctrs
:
str
=
str
(
ctr
)
# Prints to the redirected stdout ()
sys
.
stdout
.
write
(
f
"
{
ctrs
}
) this is to the redirected --->
{
inps
}
\n
"
)
# Prints to the actual saved stdout handler
stdout_fileno
.
write
(
f
"
{
ctrs
}
) this is to the actual --->
{
inps
}
\n
"
)
ctr
=
ctr
+
1
# Close the file
sys
.
stdout
.
close
()
# Restore sys.stdout to our old saved file handler
sys
.
stdout
=
stdout_fileno
In
C++23
, an updated printing interface was created for writing to the output stream, using
std::print
functions.
[
12
]
import
std
;
using
std
::
string
;
int
main
()
{
string
s
=
"Hello, world!"
;
std
::
println
(
stdout
,
"My string: {}"
,
s
);
std
::
println
(
stderr
,
"String to error stream: {}"
,
s
);
}
Graphical user interfaces
(GUIs) do not always make use of the standard streams; they do when GUIs are wrappers of underlying scripts and/or console programs, for instance the
Synaptic
package manager GUI, which wraps apt commands in Debian and/or Ubuntu. GUIs created with scripting tools like Zenity and KDialog by
KDE
project
[
13
]
make use of stdin, stdout, and stderr, and are based on simple scripts rather than a complete GUI programmed and compiled in C/C++ using
Qt
,
GTK
, or other equivalent proprietary widget framework.
The
Services menu
, as implemented on
NeXTSTEP
and
Mac OS X
, is also analogous to standard streams. On these operating systems, graphical applications can provide functionality through a system-wide menu that operates on the current
selection
in the GUI, no matter in what application.
Some GUI programs, primarily on Unix, still write debug information to standard error. Others (such as many Unix media players) may read files from standard input. Popular Windows programs that open a separate console window in addition to their GUI windows are the emulators
pSX
and
DOSBox
.
GTK-server
can use stdin as a communication interface with an interpreted program to realize a GUI.
The
Common Lisp Interface Manager
paradigm "presents" GUI elements sent to an extended output stream.
Redirection
Stream
Input/output
C file input/output
SYSIN
and
SYSOUT
Standard streams in the Files-11 file system
^
D. M. Ritchie,
"A Stream Input-Output System"
, AT&T Bell Laboratories Technical Journal, 68(8), October 1984.
^
"<unistd.h>"
.
The Open Group Base Specifications Issue 6—IEEE Std 1003.1, 2004 Edition
. The Open Group. 2004.
^
Johnson, Steve
(2013-12-11).
"[TUHS] Graphic Systems C/A/T phototypesetter"
(Mailing list).
Archived
from the original on 2020-09-25
. Retrieved
2020-11-07
.
^
"
Revised Report on the Algorithmic Language Algol 68
", edited by A. van Wijngaarden, B.J. Mailloux, J.E.L. Peck, C.H.A. Koster, M. Sintzoff, C.H. Lindsey, L.G.L.T. Meertens and R.G. Fisker, Section 10.3.
^
Dahl, Ole-Johan
; Myhrhaug, Bjørn;
Nygaard, Kristen
(1970).
Common Base Language
(PDF)
(Report). Norwegian Computing Center. Archived from the original on 2024-09-19
. Retrieved
20 August
2025
.
^
"Stdin(3): Standard I/O streams - Linux man page"
.
die.net
.
Archived
from the original on Jun 8, 2023.
^
McIlroy, M. D.
(1987).
A Research Unix reader: annotated excerpts from the Programmer's Manual, 1971–1986
(PDF)
(Technical report). CSTR. Bell Labs. 139.
Archived
(PDF)
from the original on Dec 15, 2023.
^
Bjarne Stroustrup.
"A History of C++: 1979–1991"
(PDF)
.
^
Bjarne Stroustrup (1997).
The C++ programming language
(third ed.). Addison-Wesley. pp.
637–640
.
ISBN
0-201-88954-4
.
^
"System (Java Platform SE 7)"
.
Oracle Help Center
. Retrieved
20 July
2012
.
^
".NET Framework 4.7.1, mscorlib, console.cs"
.
Reference Source - Microsoft
.
Archived
from the original on Dec 10, 2017
. Retrieved
2017-12-10
.
^
Victor Zverovich (25 March 2022).
"Formatted output"
.
open-std.org
. WG 21.
^
Kißling, Kristian (2009).
"Adding graphic elements to your scripts with Zenity and KDialog"
.
Linux Magazine
. Retrieved
2021-04-11
.
"
Standard Streams
",
The GNU C Library
KRONOS 2.1 Reference Manual
, Control Data Corporation, Part Number 60407000, 1974
NOS Version 1 Applications Programmer's Instant
, Control Data Corporation, Part Number 60436000, 1978
Level 68 Introduction to Programming on MULTICS
Archived
2021-02-25 at the
Wayback Machine
, Honeywell Corporation, 1981
Evolution of the MVS Operating System
, IBM Corporation, 1981
Lions' Commentary on UNIX Sixth Edition
, John Lions,
ISBN
1-57398-013-7
, 1977
Console Class, .NET Framework Class Library
, Microsoft Corporation, 2008
Standard Input Definition
- by The Linux Information Project
Standard Output Definition
- by The Linux Information Project
Standard Error Definition
- by The Linux Information Project |
| Markdown | [Jump to content](https://en.wikipedia.org/wiki/Standard_streams#bodyContent)
Main menu
Main menu
move to sidebar
hide
Navigation
- [Main page](https://en.wikipedia.org/wiki/Main_Page "Visit the main page [z]")
- [Contents](https://en.wikipedia.org/wiki/Wikipedia:Contents "Guides to browsing Wikipedia")
- [Current events](https://en.wikipedia.org/wiki/Portal:Current_events "Articles related to current events")
- [Random article](https://en.wikipedia.org/wiki/Special:Random "Visit a randomly selected article [x]")
- [About Wikipedia](https://en.wikipedia.org/wiki/Wikipedia:About "Learn about Wikipedia and how it works")
- [Contact us](https://en.wikipedia.org/wiki/Wikipedia:Contact_us "How to contact Wikipedia")
Contribute
- [Help](https://en.wikipedia.org/wiki/Help:Contents "Guidance on how to use and edit Wikipedia")
- [Learn to edit](https://en.wikipedia.org/wiki/Help:Introduction "Learn how to edit Wikipedia")
- [Community portal](https://en.wikipedia.org/wiki/Wikipedia:Community_portal "The hub for editors")
- [Recent changes](https://en.wikipedia.org/wiki/Special:RecentChanges "A list of recent changes to Wikipedia [r]")
- [Upload file](https://en.wikipedia.org/wiki/Wikipedia:File_upload_wizard "Add images or other media for use on Wikipedia")
- [Special pages](https://en.wikipedia.org/wiki/Special:SpecialPages "A list of all special pages [q]")
[  ](https://en.wikipedia.org/wiki/Main_Page)
[Search](https://en.wikipedia.org/wiki/Special:Search "Search Wikipedia [f]")
Appearance
- [Donate](https://donate.wikimedia.org/?wmf_source=donate&wmf_medium=sidebar&wmf_campaign=en.wikipedia.org&uselang=en)
- [Create account](https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&returnto=Standard+streams "You are encouraged to create an account and log in; however, it is not mandatory")
- [Log in](https://en.wikipedia.org/w/index.php?title=Special:UserLogin&returnto=Standard+streams "You're encouraged to log in; however, it's not mandatory. [o]")
Personal tools
- [Donate](https://donate.wikimedia.org/?wmf_source=donate&wmf_medium=sidebar&wmf_campaign=en.wikipedia.org&uselang=en)
- [Create account](https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&returnto=Standard+streams "You are encouraged to create an account and log in; however, it is not mandatory")
- [Log in](https://en.wikipedia.org/w/index.php?title=Special:UserLogin&returnto=Standard+streams "You're encouraged to log in; however, it's not mandatory. [o]")
## Contents
move to sidebar
hide
- [(Top)](https://en.wikipedia.org/wiki/Standard_streams)
- [1 Application](https://en.wikipedia.org/wiki/Standard_streams#Application)
- [2 Background](https://en.wikipedia.org/wiki/Standard_streams#Background)
- [3 Standard input (stdin)](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_\(stdin\))
- [4 Standard output (stdout)](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_\(stdout\))
- [5 Standard error (stderr)](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_\(stderr\))
- [6 Timeline](https://en.wikipedia.org/wiki/Standard_streams#Timeline)
Toggle Timeline subsection
- [6\.1 1950s: Fortran](https://en.wikipedia.org/wiki/Standard_streams#1950s:_Fortran)
- [6\.2 1960: ALGOL 60](https://en.wikipedia.org/wiki/Standard_streams#1960:_ALGOL_60)
- [6\.3 1968: ALGOL 68](https://en.wikipedia.org/wiki/Standard_streams#1968:_ALGOL_68)
- [6\.4 1968: Simula](https://en.wikipedia.org/wiki/Standard_streams#1968:_Simula)
- [6\.5 1970s: C and Unix](https://en.wikipedia.org/wiki/Standard_streams#1970s:_C_and_Unix)
- [6\.6 1990s: C++, Java](https://en.wikipedia.org/wiki/Standard_streams#1990s:_C++,_Java)
- [6\.7 2000s: .NET](https://en.wikipedia.org/wiki/Standard_streams#2000s:_.NET)
- [6\.8 2000s onward: Python, C++](https://en.wikipedia.org/wiki/Standard_streams#2000s_onward:_Python,_C++)
- [6\.9 GUIs](https://en.wikipedia.org/wiki/Standard_streams#GUIs)
- [7 See also](https://en.wikipedia.org/wiki/Standard_streams#See_also)
- [8 References](https://en.wikipedia.org/wiki/Standard_streams#References)
- [9 Sources](https://en.wikipedia.org/wiki/Standard_streams#Sources)
- [10 External links](https://en.wikipedia.org/wiki/Standard_streams#External_links)
Toggle the table of contents
# Standard streams
17 languages
- [العربية](https://ar.wikipedia.org/wiki/%D8%AA%D9%8A%D8%A7%D8%B1%D8%A7%D8%AA_%D8%A7%D9%84%D8%A8%D9%8A%D8%A7%D9%86%D8%A7%D8%AA_%D8%A7%D9%84%D9%85%D9%88%D8%AD%D8%AF%D8%A9 "تيارات البيانات الموحدة – Arabic")
- [Български](https://bg.wikipedia.org/wiki/%D0%A1%D1%82%D0%B0%D0%BD%D0%B4%D0%B0%D1%80%D1%82%D0%BD%D0%B8_%D1%81%D1%82%D1%80%D0%B8%D0%B9%D0%BC%D0%BE%D0%B2%D0%B5 "Стандартни стриймове – Bulgarian")
- [Català](https://ca.wikipedia.org/wiki/Standard_streams "Standard streams – Catalan")
- [Čeština](https://cs.wikipedia.org/wiki/Standardn%C3%AD_proudy "Standardní proudy – Czech")
- [Deutsch](https://de.wikipedia.org/wiki/Standard-Datenstr%C3%B6me "Standard-Datenströme – German")
- [Español](https://es.wikipedia.org/wiki/Flujos_de_dato_est%C3%A1ndares "Flujos de dato estándares – Spanish")
- [Français](https://fr.wikipedia.org/wiki/Flux_standard "Flux standard – French")
- [Italiano](https://it.wikipedia.org/wiki/Canali_standard "Canali standard – Italian")
- [日本語](https://ja.wikipedia.org/wiki/%E6%A8%99%E6%BA%96%E3%82%B9%E3%83%88%E3%83%AA%E3%83%BC%E3%83%A0 "標準ストリーム – Japanese")
- [한국어](https://ko.wikipedia.org/wiki/%ED%91%9C%EC%A4%80_%EC%8A%A4%ED%8A%B8%EB%A6%BC "표준 스트림 – Korean")
- [Nederlands](https://nl.wikipedia.org/wiki/Standaardstromen "Standaardstromen – Dutch")
- [Polski](https://pl.wikipedia.org/wiki/Standardowe_strumienie "Standardowe strumienie – Polish")
- [Português](https://pt.wikipedia.org/wiki/Fluxos_padr%C3%A3o "Fluxos padrão – Portuguese")
- [Русский](https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D0%B0%D0%BD%D0%B4%D0%B0%D1%80%D1%82%D0%BD%D1%8B%D0%B5_%D0%BF%D0%BE%D1%82%D0%BE%D0%BA%D0%B8 "Стандартные потоки – Russian")
- [Simple English](https://simple.wikipedia.org/wiki/Standard_streams "Standard streams – Simple English")
- [Українська](https://uk.wikipedia.org/wiki/%D0%A1%D1%82%D0%B0%D0%BD%D0%B4%D0%B0%D1%80%D1%82%D0%BD%D1%96_%D0%BF%D0%BE%D1%82%D0%BE%D0%BA%D0%B8 "Стандартні потоки – Ukrainian")
- [中文](https://zh.wikipedia.org/wiki/%E6%A8%99%E6%BA%96%E4%B8%B2%E6%B5%81 "標準串流 – Chinese")
[Edit links](https://www.wikidata.org/wiki/Special:EntityPage/Q1070408#sitelinks-wikipedia "Edit interlanguage links")
- [Article](https://en.wikipedia.org/wiki/Standard_streams "View the content page [c]")
- [Talk](https://en.wikipedia.org/wiki/Talk:Standard_streams "Discuss improvements to the content page [t]")
English
- [Read](https://en.wikipedia.org/wiki/Standard_streams)
- [Edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit "Edit this page [e]")
- [View history](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=history "Past revisions of this page [h]")
Tools
Tools
move to sidebar
hide
Actions
- [Read](https://en.wikipedia.org/wiki/Standard_streams)
- [Edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit "Edit this page [e]")
- [View history](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=history)
General
- [What links here](https://en.wikipedia.org/wiki/Special:WhatLinksHere/Standard_streams "List of all English Wikipedia pages containing links to this page [j]")
- [Related changes](https://en.wikipedia.org/wiki/Special:RecentChangesLinked/Standard_streams "Recent changes in pages linked from this page [k]")
- [Upload file](https://en.wikipedia.org/wiki/Wikipedia:File_Upload_Wizard "Upload files [u]")
- [Permanent link](https://en.wikipedia.org/w/index.php?title=Standard_streams&oldid=1344604225 "Permanent link to this revision of this page")
- [Page information](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=info "More information about this page")
- [Cite this page](https://en.wikipedia.org/w/index.php?title=Special:CiteThisPage&page=Standard_streams&id=1344604225&wpFormIdentifier=titleform "Information on how to cite this page")
- [Get shortened URL](https://en.wikipedia.org/w/index.php?title=Special:UrlShortener&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FStandard_streams)
Print/export
- [Download as PDF](https://en.wikipedia.org/w/index.php?title=Special:DownloadAsPdf&page=Standard_streams&action=show-download-screen "Download this page as a PDF file")
- [Printable version](https://en.wikipedia.org/w/index.php?title=Standard_streams&printable=yes "Printable version of this page [p]")
In other projects
- [Wikidata item](https://www.wikidata.org/wiki/Special:EntityPage/Q1070408 "Structured data on this page hosted by Wikidata [g]")
Appearance
move to sidebar
hide
From Wikipedia, the free encyclopedia
Connected input and output streams for computer programs
This article is about standard I/O file descriptors. For System V streams, see [STREAMS](https://en.wikipedia.org/wiki/STREAMS "STREAMS").
In [computer programming](https://en.wikipedia.org/wiki/Computer_programming "Computer programming"), **standard streams** are preconnected input and output [communication channels](https://en.wikipedia.org/wiki/Communication_channel "Communication channel")[\[1\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-1) between a computer program and its environment when it begins execution. The three [input/output](https://en.wikipedia.org/wiki/Input/output "Input/output") (I/O) connections are called **standard input** (**stdin**), **standard output** (**stdout**) and **standard error** (**stderr**). Originally I/O happened via a physically connected [system console](https://en.wikipedia.org/wiki/System_console "System console") (input via keyboard, output via monitor), but standard streams abstract this. When a command is executed via an interactive [shell](https://en.wikipedia.org/wiki/Shell_\(computing\) "Shell (computing)"), the streams are typically connected to the [text terminal](https://en.wikipedia.org/wiki/Text_terminal "Text terminal") on which the shell is running, but can be changed with [redirection](https://en.wikipedia.org/wiki/Redirection_\(computing\) "Redirection (computing)") or a [pipeline](https://en.wikipedia.org/wiki/Pipeline_\(Unix\) "Pipeline (Unix)"). More generally, a [child process](https://en.wikipedia.org/wiki/Child_process "Child process") inherits the standard streams of its [parent process](https://en.wikipedia.org/wiki/Parent_process "Parent process").
## Application
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=1 "Edit section: Application")\]
[](https://en.wikipedia.org/wiki/File:Stdstreams-notitle.svg)
The standard streams for input, output, and error in a common default configuration
Users generally know standard streams as input and output channels that handle data coming from an input device, or that write data from the application. The data may be text with any encoding, or [binary data](https://en.wikipedia.org/wiki/Binary_file "Binary file"). When a program is run as a [daemon](https://en.wikipedia.org/wiki/Daemon_\(computing\) "Daemon (computing)"), its standard error stream is redirected into a log file, typically for error analysis purposes.
Streams may be used to chain applications, meaning that the output stream of one program can be redirected to be the input stream to another application. In many operating systems this is expressed by listing the application names, separated by the vertical bar character, for this reason often called the [pipeline](https://en.wikipedia.org/wiki/Pipeline_\(Unix\) "Pipeline (Unix)") character. A well-known example is the use of a [pagination](https://en.wikipedia.org/wiki/Pagination "Pagination") application, such as [more](https://en.wikipedia.org/wiki/More_\(command\) "More (command)"), providing the user control over the display of the output stream on the display.
## Background
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=2 "Edit section: Background")\]
In most operating systems predating [Unix](https://en.wikipedia.org/wiki/Unix "Unix"), programs had to explicitly connect to the appropriate input and output devices. OS-specific intricacies caused this to be a tedious programming task. On many systems it was necessary to obtain control of environment settings, access a local file table, determine the intended data set, and handle hardware correctly in the case of a [punch card reader](https://en.wikipedia.org/wiki/Punch_card_reader "Punch card reader"), [magnetic tape drive](https://en.wikipedia.org/wiki/Magnetic_tape_drive "Magnetic tape drive"), [disk drive](https://en.wikipedia.org/wiki/Disk_drive "Disk drive"), [line printer](https://en.wikipedia.org/wiki/Line_printer "Line printer"), card punch, or interactive terminal.
One of Unix's several groundbreaking advances was *abstract devices*, which removed the need for a program to know or care what kind of devices it was communicating with\[*[citation needed](https://en.wikipedia.org/wiki/Wikipedia:Citation_needed "Wikipedia:Citation needed")*\]. Older operating systems forced upon the programmer a record structure and frequently [non-orthogonal](https://en.wikipedia.org/wiki/Orthogonal#Computer_science "Orthogonal") data semantics and device control. Unix eliminated this complexity with the concept of a data stream: an ordered sequence of data bytes which can be read until the [end of file](https://en.wikipedia.org/wiki/End-of-file "End-of-file"). A program may also write bytes as desired and need not, and cannot easily declare their count or grouping.
Another Unix breakthrough was to automatically associate input and output to terminal keyboard and terminal display, respectively, by default\[*[citation needed](https://en.wikipedia.org/wiki/Wikipedia:Citation_needed "Wikipedia:Citation needed")*\] — the program (and programmer) did absolutely nothing to establish input and output for a typical input-process-output program (unless it chose a different paradigm). In contrast, previous operating systems usually required some—often complex—[job control language](https://en.wikipedia.org/wiki/Job_Control_Language "Job Control Language") to establish connections, or the equivalent burden had to be orchestrated by the program.\[*[citation needed](https://en.wikipedia.org/wiki/Wikipedia:Citation_needed "Wikipedia:Citation needed")*\]
Since Unix provided standard streams, the Unix [C](https://en.wikipedia.org/wiki/C_\(programming_language\) "C (programming language)") runtime environment was obliged to support it as well. As a result, most C runtime environments (and [C's descendants](https://en.wikipedia.org/wiki/C_\(programming_language\)#Related_languages "C (programming language)")), regardless of the operating system, provide equivalent functionality.
## Standard input (stdin)
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=3 "Edit section: Standard input (stdin)")\]
Standard input is a stream from which a program reads its input data. The program requests data transfers by use of the *read* operation. Not all programs require stream input. For example, the *[dir](https://en.wikipedia.org/wiki/Dir_\(command\) "Dir (command)")* and *[ls](https://en.wikipedia.org/wiki/Ls "Ls")* programs (which display file names contained in a directory) may take [command-line arguments](https://en.wikipedia.org/wiki/Command-line_interface#Arguments "Command-line interface"), but perform their operations without any stream data input.
Unless [redirected](https://en.wikipedia.org/wiki/Redirection_\(computing\) "Redirection (computing)"), standard input is inherited from the parent process. In the case of an interactive shell, that is usually associated with the input device of a [terminal](https://en.wikipedia.org/wiki/Computer_terminal "Computer terminal") (or [pseudo terminal](https://en.wikipedia.org/wiki/Pseudoterminal "Pseudoterminal")) which is ultimately linked to a user's [keyboard](https://en.wikipedia.org/wiki/Keyboard_\(computing\) "Keyboard (computing)").
On [POSIX](https://en.wikipedia.org/wiki/POSIX "POSIX") systems, the [file descriptor](https://en.wikipedia.org/wiki/File_descriptor "File descriptor") for standard input is 0 (zero); the [POSIX](https://en.wikipedia.org/wiki/POSIX "POSIX") `<unistd.h>` definition is `STDIN_FILENO`; the corresponding C `<stdio.h>` abstraction is provided via the `stdin` (of type `FILE*`) global variable. Similarly in [C++](https://en.wikipedia.org/wiki/C%2B%2B "C++"), the global object `std::cin` (of type `std::istream`). provided in `<iostream>`, provides an abstraction via [C++ streams](https://en.wikipedia.org/wiki/Input/output_\(C%2B%2B\)#Input/output_streams "Input/output (C++)"). Similar abstractions exist in the standard I/O libraries of practically every [programming language](https://en.wikipedia.org/wiki/Programming_language "Programming language").
## Standard output (stdout)
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=4 "Edit section: Standard output (stdout)")\]
Standard output is a stream to which a program writes its output data. The program requests data transfer with the *write* operation. Not all programs generate output. For example, the *[file rename](https://en.wikipedia.org/wiki/Rename_\(computing\) "Rename (computing)")* command (variously called *[mv](https://en.wikipedia.org/wiki/Mv_\(Unix\) "Mv (Unix)")*, *[move](https://en.wikipedia.org/wiki/Move_\(command\) "Move (command)")*, or *[ren](https://en.wikipedia.org/wiki/Ren_\(command\) "Ren (command)")*) is silent on success.
Unless [redirected](https://en.wikipedia.org/wiki/Redirection_\(computing\) "Redirection (computing)"), standard output is inherited from the parent process. In the case of an interactive shell, that is usually the [text terminal](https://en.wikipedia.org/wiki/Text_terminal "Text terminal") which initiated the program.
The [file descriptor](https://en.wikipedia.org/wiki/File_descriptor "File descriptor") for standard output is 1 (one); the [POSIX](https://en.wikipedia.org/wiki/POSIX "POSIX") `<unistd.h>` definition is `STDOUT_FILENO`; the corresponding C `<stdio.h>` variable is `stdout` (of type `FILE*`); similarly in C++, the global object `std::cout` (of type `std::ostream`), provided in `<iostream>`, abstracts the output stream.
## Standard error (stderr)
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=5 "Edit section: Standard error (stderr)")\]
Standard error is another output stream typically used by programs to output [error messages](https://en.wikipedia.org/wiki/Error_message "Error message") or diagnostics. It is a stream independent of standard output and can be redirected separately.
This solves the [semi-predicate problem](https://en.wikipedia.org/wiki/Semipredicate_problem "Semipredicate problem"), allowing output and errors to be distinguished, and is analogous to a function returning a pair of values – see [Semipredicate problem § Multivalued return](https://en.wikipedia.org/wiki/Semipredicate_problem#Multivalued_return "Semipredicate problem"). The usual destination is the [text terminal](https://en.wikipedia.org/wiki/Text_terminal "Text terminal") which started the program to provide the best chance of being seen even if *standard output* is redirected (so not readily observed). For example, output of a program in a [pipeline](https://en.wikipedia.org/wiki/Pipeline_\(Unix\) "Pipeline (Unix)") is redirected to input of the next program or a text file, but user prompts and errors from each program still go directly to the text terminal so they can be reviewed by the user in real time.
It is acceptable and normal to direct *standard output* and *standard error* to the same destination, such as the text terminal. Messages appear in the same order as the program writes them, unless [buffering](https://en.wikipedia.org/wiki/Data_buffer "Data buffer") is involved. For example, in common situations the standard error stream is unbuffered but the standard output stream is line-buffered; in this case, text written to standard error later may appear on the terminal earlier, if the standard output stream buffer is not yet full.
The [file descriptor](https://en.wikipedia.org/wiki/File_descriptor "File descriptor") for standard error is defined by [POSIX](https://en.wikipedia.org/wiki/POSIX "POSIX") as 2 (two); the *\<unistd.h\>* header file provides the symbol `STDERR_FILENO`;[\[2\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-2) the corresponding C `<stdio.h>` variable is `stderr` (of type `FILE*`). Similarly, C++ provides two global objects associated with this stream: `std::cerr` and `std::clog` (each of type `std::ostream`), in `<iostream>`, with the former being unbuffered and the latter using the same buffering mechanism as all other C++ streams.
[Bourne](https://en.wikipedia.org/wiki/Bourne_shell "Bourne shell")\-style shells allow *standard error* to be redirected to the same destination that standard output is directed to using
```
2>&1
```
[csh](https://en.wikipedia.org/wiki/C_shell "C shell")\-style shells allow *standard error* to be redirected to the same destination that standard output is directed to using
```
>&
```
Standard error was added to Unix in the 1970s after several wasted phototypesetting runs ended with error messages being typeset instead of displayed on the user's terminal.[\[3\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-3)
## Timeline
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=6 "Edit section: Timeline")\]
### 1950s: Fortran
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=7 "Edit section: 1950s: Fortran")\]
[Fortran](https://en.wikipedia.org/wiki/Fortran "Fortran") has the equivalent of Unix file descriptors: By convention, many Fortran implementations use unit numbers `UNIT=5` for stdin, `UNIT=6` for stdout and `UNIT=0` for stderr. In Fortran-2003, the intrinsic `ISO_FORTRAN_ENV` module was standardized to include the named constants `INPUT_UNIT`, `OUTPUT_UNIT`, and `ERROR_UNIT` to portably specify the unit numbers.
```
! FORTRAN 77 example
PROGRAM MAIN
INTEGER NUMBER
READ(UNIT=5,*) NUMBER
WRITE(UNIT=6,'(A,I3)') ' NUMBER IS: ',NUMBER
END
```
```
! Fortran 2003 example
program main
use iso_fortran_env
implicit none
integer :: number
read (unit=INPUT_UNIT,*) number
write (unit=OUTPUT_UNIT,'(a,i3)') 'Number is: ', number
end program
```
### 1960: ALGOL 60
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=8 "Edit section: 1960: ALGOL 60")\]
[ALGOL 60](https://en.wikipedia.org/wiki/ALGOL_60 "ALGOL 60") was criticized for having no standard file access.\[*[citation needed](https://en.wikipedia.org/wiki/Wikipedia:Citation_needed "Wikipedia:Citation needed")*\]
### 1968: ALGOL 68
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=9 "Edit section: 1968: ALGOL 68")\]
[ALGOL 68](https://en.wikipedia.org/wiki/ALGOL_68 "ALGOL 68")'s input and output facilities were collectively referred to as the transput.[\[4\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-4) [Koster](https://en.wikipedia.org/wiki/Cornelis_H._A._Koster "Cornelis H. A. Koster") coordinated the definition of the *transput* standard. The model included three standard channels: `stand in`, `stand out`, and `stand back`.
| Input: | Output: |
|---|---|
### 1968: Simula
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=10 "Edit section: 1968: Simula")\]
An other example is the OOP language.[\[5\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-CommonBase-5): 11
```
class BASICIO (LINELENGTH); integer LINELENGTH;
begin ref (infile) SYSIN;
ref (infile) procedure sysin;
sysin :- SYSIN;
ref (printfle) SYSOUT;
ref (printfle) procedure sysout;
sysout :- SYSOUT;
class FILE ....................;
FILE class infile ............;
FILE class outfile ...........;
FILE class directfile ........;
outfile class printfle .......;
SYSIN :- new infile ("SYSIN");
SYSOUT :- new printfle ("SYSOUT");
SYSIN.open (blanks(80));
SYSOUT.open(blanks(LINELENGTH));
inner;
SYSIN.close;
SYSOUT.close;
end BASICIO;
```
### 1970s: C and Unix
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=11 "Edit section: 1970s: C and Unix")\]
In the [C programming language](https://en.wikipedia.org/wiki/C_programming_language "C programming language"), the standard input, output, and error streams are attached to the existing Unix file descriptors 0, 1 and 2 respectively.[\[6\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-6) In a [POSIX](https://en.wikipedia.org/wiki/POSIX "POSIX") environment the *\<[unistd.h](https://en.wikipedia.org/wiki/Unistd.h "Unistd.h")\>* definitions `STDIN_FILENO`, `STDOUT_FILENO` or `STDERR_FILENO` should be used instead rather than [magic numbers](https://en.wikipedia.org/wiki/Magic_number_\(programming\) "Magic number (programming)"). File pointers `stdin`, `stdout`, and `stderr` are also provided.
[Ken Thompson](https://en.wikipedia.org/wiki/Ken_Thompson "Ken Thompson") (designer and implementer of the original Unix operating system) modified [sort](https://en.wikipedia.org/wiki/Sort_\(Unix\) "Sort (Unix)") in [Version 5 Unix](https://en.wikipedia.org/wiki/Version_5_Unix "Version 5 Unix") to accept "-" as representing standard input, which spread to other utilities and became a part of the operating system as a [special file](https://en.wikipedia.org/wiki/Special_file "Special file") in [Version 8](https://en.wikipedia.org/wiki/Version_8_Unix "Version 8 Unix"). Diagnostics were part of standard output through [Version 6](https://en.wikipedia.org/wiki/Version_6_Unix "Version 6 Unix"), after which [Dennis M. Ritchie](https://en.wikipedia.org/wiki/Dennis_M._Ritchie "Dennis M. Ritchie") created the concept of standard error.[\[7\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-reader-7)
### 1990s: C++, Java
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=12 "Edit section: 1990s: C++, Java")\]
In [C++](https://en.wikipedia.org/wiki/C%2B%2B "C++"), writing to standard streams was originally done using the `<iostream>` header and its streams, until the release of `<print>` which simplified input/output using print functions.[\[8\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-8) C++ inherits [C I/O facilities](https://en.wikipedia.org/wiki/C_file_input/output "C file input/output"), but it is considered more idiomatic to use the newer C++ facilities.[\[9\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-C++_stroustrup_fstrem-9)
```
#include <iostream>
#include <string>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;
using std::string;
int main() {
string input;
cout << "Write a sentence: " << endl;
cin >> input;
int inputLength = input.length();
cout << "Sentence: " << input << ", of length " << inputLength << endl;
cerr << "Sentence written to stderr: " << input << endl;
}
```
In [Java](https://en.wikipedia.org/wiki/Java_\(programming_language\) "Java (programming language)"), the standard streams are referred to by `System.in` (for stdin), `System.out` (for stdout), and `System.err` (for stderr).[\[10\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-10) It is also possible to read from any input stream using a `Scanner`.
```
package org.wikipedia.examples;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Example {
public static void main(String args[]) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s = br.readLine();
double number = Double.parseDouble(s);
System.out.printf("Number is: %d%n", number);
// Read input for a name and age:
Scanner input = new Scanner(System.in);
System.out.printf("%nEnter name: ");
String name = input.nextLine();
System.out.printf("%nEnter age: ");
int age = input.nextInt();
System.out.printf("Hello, %s! You are %d years old.", name, age);
} catch (IOException e) {
System.err.printf("Error in input/output: %s%n", e.getMessage());
} catch (Exception e) {
System.err.printf("Error: %s%n", e.getMessage());
}
}
}
```
### 2000s: .NET
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=13 "Edit section: 2000s: .NET")\]
In [C\#](https://en.wikipedia.org/wiki/C_Sharp_\(programming_language\) "C Sharp (programming language)") and other [.NET](https://en.wikipedia.org/wiki/.NET_Framework ".NET Framework") languages, the standard streams are referred to by `System.Console.In` (for stdin), `System.Console.Out` (for stdout) and `System.Console.Error` (for stderr).[\[11\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-11) Basic read and write capabilities for the stdin and stdout streams are also accessible directly through the class `System.Console` (e.g. `System.Console.WriteLine()` can be used instead of `System.Console.Out.WriteLine()`).
`System.Console.In`, `System.Console.Out` and `System.Console.Error` are respectively `System.IO.TextReader` (stdin) and `System.IO.TextWriter` (stdout, stderr) objects, which only allow access to the underlying standard streams on a text basis. Full binary access to the standard streams must be performed through the `System.IO.Stream` objects returned by `System.Console.OpenStandardInput()`, `System.Console.OpenStandardOutput()` and `System.Console.OpenStandardError()` respectively.
```
namespace Wikipeda.Examples;
using System;
public class Example {
static int Main(string[] args)
{
try
{
string s = Console.In.ReadLine();
double number = Double.Parse(s);
Console.Out.WriteLine("Number is: {0:F3}", number);
} // If Parse() threw an exception
catch (ArgumentNullException e)
{
Console.Error.WriteLine($"No number was entered: {e.Message}");
return 1;
}
catch (FormatException e)
{
Console.Error.WriteLine($"The specified value is not a valid number: {e.Message}");
return 2;
}
catch (OverflowException e)
{
Console.Error.WriteLine($"The specified number is too big: {e.Message}");
return 3;
}
catch (Exception ex)
{
Console.Error.WriteLine($"An unknown exception occurred: {e.Message}");
return -1;
}
return 0;
}
```
```
' Visual Basic .NET example
Public Function Main() As Integer
Try
Dim s As String = System.Console.[In].ReadLine()
Dim number As Double = Double.Parse(s)
System.Console.Out.WriteLine("Number is: {0:F3}", number)
Return 0
' If Parse() threw an exception
Catch ex As System.ArgumentNullException
System.Console.[Error].WriteLine("No number was entered!")
Catch ex2 As System.FormatException
System.Console.[Error].WriteLine("The specified value is not a valid number!")
Catch ex3 As System.OverflowException
System.Console.[Error].WriteLine("The specified number is too big!")
End Try
Return -1
End Function
```
When applying the `System.Diagnostics.Process` [class](https://en.wikipedia.org/wiki/Class_\(computer_science\) "Class (computer science)") one can use the instance [properties](https://en.wikipedia.org/wiki/Property_\(programming\) "Property (programming)") `StandardInput`, `StandardOutput`, and `StandardError` of that class to access the standard streams of the process.
### 2000s onward: Python, C++
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=14 "Edit section: 2000s onward: Python, C++")\]
The following example, written in [Python](https://en.wikipedia.org/wiki/Python_\(programming_language\) "Python (programming language)"), shows how to redirect the standard input both to the standard output and to a text file.
```
#!/usr/bin/env python
import sys
from typing import TextIO
if __name__ == "__main__":
# Save the current stdout so that we can revert sys.stdout
# after we complete our redirection
stdin_fileno: TextIO = sys.stdin
stdout_fileno: TextIO = sys.stdout
# Redirect sys.stdout to the file
sys.stdout: TextIO = open("myfile.txt", "w")
ctr: int = 0
for inps in stdin_fileno:
ctrs: str = str(ctr)
# Prints to the redirected stdout ()
sys.stdout.write(f"{ctrs}) this is to the redirected --->{inps}\n")
# Prints to the actual saved stdout handler
stdout_fileno.write(f"{ctrs}) this is to the actual --->{inps}\n")
ctr = ctr + 1
# Close the file
sys.stdout.close()
# Restore sys.stdout to our old saved file handler
sys.stdout = stdout_fileno
```
In [C++23](https://en.wikipedia.org/wiki/C%2B%2B23 "C++23"), an updated printing interface was created for writing to the output stream, using `std::print` functions.[\[12\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-12)
```
import std;
using std::string;
int main() {
string s = "Hello, world!";
std::println(stdout, "My string: {}", s);
std::println(stderr, "String to error stream: {}", s);
}
```
### GUIs
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=15 "Edit section: GUIs")\]
[Graphical user interfaces](https://en.wikipedia.org/wiki/Graphical_user_interface "Graphical user interface") (GUIs) do not always make use of the standard streams; they do when GUIs are wrappers of underlying scripts and/or console programs, for instance the [Synaptic](https://en.wikipedia.org/wiki/Synaptic_\(software\) "Synaptic (software)") package manager GUI, which wraps apt commands in Debian and/or Ubuntu. GUIs created with scripting tools like Zenity and KDialog by [KDE](https://en.wikipedia.org/wiki/KDE "KDE") project[\[13\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-13) make use of stdin, stdout, and stderr, and are based on simple scripts rather than a complete GUI programmed and compiled in C/C++ using [Qt](https://en.wikipedia.org/wiki/Qt_\(software\) "Qt (software)"), [GTK](https://en.wikipedia.org/wiki/GTK "GTK"), or other equivalent proprietary widget framework.
The [Services menu](https://en.wikipedia.org/wiki/Services_menu "Services menu"), as implemented on [NeXTSTEP](https://en.wikipedia.org/wiki/NeXTSTEP "NeXTSTEP") and [Mac OS X](https://en.wikipedia.org/wiki/Mac_OS_X "Mac OS X"), is also analogous to standard streams. On these operating systems, graphical applications can provide functionality through a system-wide menu that operates on the current [selection](https://en.wiktionary.org/wiki/selection "wikt:selection") in the GUI, no matter in what application.
Some GUI programs, primarily on Unix, still write debug information to standard error. Others (such as many Unix media players) may read files from standard input. Popular Windows programs that open a separate console window in addition to their GUI windows are the emulators [pSX](https://en.wikipedia.org/w/index.php?title=PSX_\(emulator\)&action=edit&redlink=1 "PSX (emulator) (page does not exist)") and [DOSBox](https://en.wikipedia.org/wiki/DOSBox "DOSBox").
[GTK-server](https://en.wikipedia.org/wiki/GTK-server "GTK-server") can use stdin as a communication interface with an interpreted program to realize a GUI.
The [Common Lisp Interface Manager](https://en.wikipedia.org/wiki/CLIM "CLIM") paradigm "presents" GUI elements sent to an extended output stream.
## See also
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=16 "Edit section: See also")\]
- [Redirection](https://en.wikipedia.org/wiki/Redirection_\(computing\) "Redirection (computing)")
- [Stream](https://en.wikipedia.org/wiki/Stream_\(computing\) "Stream (computing)")
- [Input/output](https://en.wikipedia.org/wiki/Input/output "Input/output")
- [C file input/output](https://en.wikipedia.org/wiki/C_file_input/output "C file input/output")
- [SYSIN](https://en.wikipedia.org/wiki/SYSIN "SYSIN") and [SYSOUT](https://en.wikipedia.org/wiki/SYSOUT "SYSOUT")
- [Standard streams in the Files-11 file system](https://en.wikipedia.org/wiki/Files-11#Logical_names "Files-11")
## References
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=17 "Edit section: References")\]
1. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-1)** D. M. Ritchie, ["A Stream Input-Output System"](https://cseweb.ucsd.edu/classes/fa01/cse221/papers/ritchie-stream-io-belllabs84.pdf), AT\&T Bell Laboratories Technical Journal, 68(8), October 1984.
2. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-2)**
["\<unistd.h\>"](http://pubs.opengroup.org/onlinepubs/009695399/basedefs/unistd.h.html). *The Open Group Base Specifications Issue 6—IEEE Std 1003.1, 2004 Edition*. The Open Group. 2004.
3. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-3)**
[Johnson, Steve](https://en.wikipedia.org/wiki/Stephen_C._Johnson "Stephen C. Johnson") (2013-12-11). ["\[TUHS\] Graphic Systems C/A/T phototypesetter"](https://minnie.tuhs.org/pipermail/tuhs/2013-December/006113.html) (Mailing list). [Archived](https://web.archive.org/web/20200925010614/https://minnie.tuhs.org/pipermail/tuhs/2013-December/006113.html) from the original on 2020-09-25. Retrieved 2020-11-07.
4. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-4)** "[Revised Report on the Algorithmic Language Algol 68](http://www.softwarepreservation.org/projects/ALGOL/report/Algol68_revised_report-AB.pdf)", edited by A. van Wijngaarden, B.J. Mailloux, J.E.L. Peck, C.H.A. Koster, M. Sintzoff, C.H. Lindsey, L.G.L.T. Meertens and R.G. Fisker, Section 10.3.
5. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-CommonBase_5-0)**
[Dahl, Ole-Johan](https://en.wikipedia.org/wiki/Ole-Johan_Dahl "Ole-Johan Dahl"); Myhrhaug, Bjørn; [Nygaard, Kristen](https://en.wikipedia.org/wiki/Kristen_Nygaard "Kristen Nygaard") (1970). [Common Base Language](https://web.archive.org/web/20240919044713/https://www.softwarepreservation.org/projects/ALGOL/manual/Simula-CommonBaseLanguage.pdf) (PDF) (Report). Norwegian Computing Center. Archived from the original on 2024-09-19. Retrieved 20 August 2025.
6. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-6)**
["Stdin(3): Standard I/O streams - Linux man page"](http://linux.die.net/man/3/stdin). *die.net*. [Archived](https://web.archive.org/web/20230608111413/https://linux.die.net/man/3/stdin) from the original on Jun 8, 2023.
7. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-reader_7-0)**
[McIlroy, M. D.](https://en.wikipedia.org/wiki/Doug_McIlroy "Doug McIlroy") (1987). [*A Research Unix reader: annotated excerpts from the Programmer's Manual, 1971–1986*](http://www.cs.dartmouth.edu/~doug/reader.pdf) (PDF) (Technical report). CSTR. Bell Labs. 139. [Archived](https://web.archive.org/web/20231215143742/https://www.cs.dartmouth.edu/~doug/reader.pdf) (PDF) from the original on Dec 15, 2023.
8. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-8)**
Bjarne Stroustrup. ["A History of C++: 1979–1991"](http://www.stroustrup.com/hopl2.pdf) (PDF).
9. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-C++_stroustrup_fstrem_9-0)**
Bjarne Stroustrup (1997). [*The C++ programming language*](https://archive.org/details/cprogramminglang00stro_0/page/637) (third ed.). Addison-Wesley. pp. [637–640](https://archive.org/details/cprogramminglang00stro_0/page/637). [ISBN](https://en.wikipedia.org/wiki/ISBN_\(identifier\) "ISBN (identifier)")
[0-201-88954-4](https://en.wikipedia.org/wiki/Special:BookSources/0-201-88954-4 "Special:BookSources/0-201-88954-4")
.
10. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-10)**
["System (Java Platform SE 7)"](http://docs.oracle.com/javase/7/docs/api/java/lang/System.html). *Oracle Help Center*. Retrieved 20 July 2012.
11. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-11)**
[".NET Framework 4.7.1, mscorlib, console.cs"](https://referencesource.microsoft.com/#mscorlib/system/console.cs,34). *Reference Source - Microsoft*. [Archived](https://web.archive.org/web/20171210072215/https://referencesource.microsoft.com/#mscorlib/system/console.cs,34) from the original on Dec 10, 2017. Retrieved 2017-12-10.
12. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-12)**
Victor Zverovich (25 March 2022). ["Formatted output"](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2093r14.html). *open-std.org*. WG 21.
13. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-13)**
Kißling, Kristian (2009). ["Adding graphic elements to your scripts with Zenity and KDialog"](https://www.linux-magazine.com/Issues/2009/99/Zenity-and-KDialog). *[Linux Magazine](https://en.wikipedia.org/wiki/Linux_Magazine "Linux Magazine")*. Retrieved 2021-04-11.
## Sources
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=18 "Edit section: Sources")\]
- "[Standard Streams](https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html)", [The GNU C Library](https://www.gnu.org/software/libc/manual/html_node/index.html)
- *KRONOS 2.1 Reference Manual*, Control Data Corporation, Part Number 60407000, 1974
- *NOS Version 1 Applications Programmer's Instant*, Control Data Corporation, Part Number 60436000, 1978
- [Level 68 Introduction to Programming on MULTICS](http://www.bitsavers.org/pdf/honeywell/multics/AG90-03_PgmgIntro_Dec81.pdf) [Archived](https://web.archive.org/web/20210225022744/http://www.bitsavers.org/pdf/honeywell/multics/AG90-03_PgmgIntro_Dec81.pdf) 2021-02-25 at the [Wayback Machine](https://en.wikipedia.org/wiki/Wayback_Machine "Wayback Machine"), Honeywell Corporation, 1981
- [Evolution of the MVS Operating System](https://web.archive.org/web/20191009002342/https://pdfs.semanticscholar.org/a8e4/4d068a376c42513a4e10d6a751702710afee.pdf), IBM Corporation, 1981
- *Lions' Commentary on UNIX Sixth Edition*, John Lions,
[ISBN](https://en.wikipedia.org/wiki/ISBN_\(identifier\) "ISBN (identifier)")
[1-57398-013-7](https://en.wikipedia.org/wiki/Special:BookSources/1-57398-013-7 "Special:BookSources/1-57398-013-7")
, 1977
- [Console Class, .NET Framework Class Library](http://msdn2.microsoft.com/en-us/library/system.console.aspx), Microsoft Corporation, 2008
## External links
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=19 "Edit section: External links")\]
- [Standard Input Definition](http://www.linfo.org/standard_input.html) - by The Linux Information Project
- [Standard Output Definition](http://www.linfo.org/standard_output.html) - by The Linux Information Project
- [Standard Error Definition](http://www.linfo.org/standard_error.html) - by The Linux Information Project

Retrieved from "<https://en.wikipedia.org/w/index.php?title=Standard_streams&oldid=1344604225>"
[Category](https://en.wikipedia.org/wiki/Help:Category "Help:Category"):
- [Unix](https://en.wikipedia.org/wiki/Category:Unix "Category:Unix")
Hidden categories:
- [CS1: unfit URL](https://en.wikipedia.org/wiki/Category:CS1:_unfit_URL "Category:CS1: unfit URL")
- [Articles with short description](https://en.wikipedia.org/wiki/Category:Articles_with_short_description "Category:Articles with short description")
- [Short description is different from Wikidata](https://en.wikipedia.org/wiki/Category:Short_description_is_different_from_Wikidata "Category:Short description is different from Wikidata")
- [All articles with unsourced statements](https://en.wikipedia.org/wiki/Category:All_articles_with_unsourced_statements "Category:All articles with unsourced statements")
- [Articles with unsourced statements from December 2013](https://en.wikipedia.org/wiki/Category:Articles_with_unsourced_statements_from_December_2013 "Category:Articles with unsourced statements from December 2013")
- [Articles with unsourced statements from October 2017](https://en.wikipedia.org/wiki/Category:Articles_with_unsourced_statements_from_October_2017 "Category:Articles with unsourced statements from October 2017")
- [Articles with unsourced statements from February 2012](https://en.wikipedia.org/wiki/Category:Articles_with_unsourced_statements_from_February_2012 "Category:Articles with unsourced statements from February 2012")
- [Webarchive template wayback links](https://en.wikipedia.org/wiki/Category:Webarchive_template_wayback_links "Category:Webarchive template wayback links")
- This page was last edited on 21 March 2026, at 13:44 (UTC).
- Text is available under the [Creative Commons Attribution-ShareAlike 4.0 License](https://en.wikipedia.org/wiki/Wikipedia:Text_of_the_Creative_Commons_Attribution-ShareAlike_4.0_International_License "Wikipedia:Text of the Creative Commons Attribution-ShareAlike 4.0 International License"); additional terms may apply. By using this site, you agree to the [Terms of Use](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use "foundation:Special:MyLanguage/Policy:Terms of Use") and [Privacy Policy](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy "foundation:Special:MyLanguage/Policy:Privacy policy"). Wikipedia® is a registered trademark of the [Wikimedia Foundation, Inc.](https://wikimediafoundation.org/), a non-profit organization.
- [Privacy policy](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy)
- [About Wikipedia](https://en.wikipedia.org/wiki/Wikipedia:About)
- [Disclaimers](https://en.wikipedia.org/wiki/Wikipedia:General_disclaimer)
- [Contact Wikipedia](https://en.wikipedia.org/wiki/Wikipedia:Contact_us)
- [Legal & safety contacts](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Legal:Wikimedia_Foundation_Legal_and_Safety_Contact_Information)
- [Code of Conduct](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Universal_Code_of_Conduct)
- [Developers](https://developer.wikimedia.org/)
- [Statistics](https://stats.wikimedia.org/#/en.wikipedia.org)
- [Cookie statement](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement)
- [Mobile view](https://en.wikipedia.org/w/index.php?title=Standard_streams&mobileaction=toggle_view_mobile)
- [](https://www.wikimedia.org/)
- [](https://www.mediawiki.org/)
Search
Toggle the table of contents
Standard streams
17 languages
[Add topic](https://en.wikipedia.org/wiki/Standard_streams) |
| Readable Markdown | This article is about standard I/O file descriptors. For System V streams, see [STREAMS](https://en.wikipedia.org/wiki/STREAMS "STREAMS").
In [computer programming](https://en.wikipedia.org/wiki/Computer_programming "Computer programming"), **standard streams** are preconnected input and output [communication channels](https://en.wikipedia.org/wiki/Communication_channel "Communication channel")[\[1\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-1) between a computer program and its environment when it begins execution. The three [input/output](https://en.wikipedia.org/wiki/Input/output "Input/output") (I/O) connections are called **standard input** (**stdin**), **standard output** (**stdout**) and **standard error** (**stderr**). Originally I/O happened via a physically connected [system console](https://en.wikipedia.org/wiki/System_console "System console") (input via keyboard, output via monitor), but standard streams abstract this. When a command is executed via an interactive [shell](https://en.wikipedia.org/wiki/Shell_\(computing\) "Shell (computing)"), the streams are typically connected to the [text terminal](https://en.wikipedia.org/wiki/Text_terminal "Text terminal") on which the shell is running, but can be changed with [redirection](https://en.wikipedia.org/wiki/Redirection_\(computing\) "Redirection (computing)") or a [pipeline](https://en.wikipedia.org/wiki/Pipeline_\(Unix\) "Pipeline (Unix)"). More generally, a [child process](https://en.wikipedia.org/wiki/Child_process "Child process") inherits the standard streams of its [parent process](https://en.wikipedia.org/wiki/Parent_process "Parent process").
[](https://en.wikipedia.org/wiki/File:Stdstreams-notitle.svg)
The standard streams for input, output, and error in a common default configuration
Users generally know standard streams as input and output channels that handle data coming from an input device, or that write data from the application. The data may be text with any encoding, or [binary data](https://en.wikipedia.org/wiki/Binary_file "Binary file"). When a program is run as a [daemon](https://en.wikipedia.org/wiki/Daemon_\(computing\) "Daemon (computing)"), its standard error stream is redirected into a log file, typically for error analysis purposes.
Streams may be used to chain applications, meaning that the output stream of one program can be redirected to be the input stream to another application. In many operating systems this is expressed by listing the application names, separated by the vertical bar character, for this reason often called the [pipeline](https://en.wikipedia.org/wiki/Pipeline_\(Unix\) "Pipeline (Unix)") character. A well-known example is the use of a [pagination](https://en.wikipedia.org/wiki/Pagination "Pagination") application, such as [more](https://en.wikipedia.org/wiki/More_\(command\) "More (command)"), providing the user control over the display of the output stream on the display.
In most operating systems predating [Unix](https://en.wikipedia.org/wiki/Unix "Unix"), programs had to explicitly connect to the appropriate input and output devices. OS-specific intricacies caused this to be a tedious programming task. On many systems it was necessary to obtain control of environment settings, access a local file table, determine the intended data set, and handle hardware correctly in the case of a [punch card reader](https://en.wikipedia.org/wiki/Punch_card_reader "Punch card reader"), [magnetic tape drive](https://en.wikipedia.org/wiki/Magnetic_tape_drive "Magnetic tape drive"), [disk drive](https://en.wikipedia.org/wiki/Disk_drive "Disk drive"), [line printer](https://en.wikipedia.org/wiki/Line_printer "Line printer"), card punch, or interactive terminal.
One of Unix's several groundbreaking advances was *abstract devices*, which removed the need for a program to know or care what kind of devices it was communicating with\[*[citation needed](https://en.wikipedia.org/wiki/Wikipedia:Citation_needed "Wikipedia:Citation needed")*\]. Older operating systems forced upon the programmer a record structure and frequently [non-orthogonal](https://en.wikipedia.org/wiki/Orthogonal#Computer_science "Orthogonal") data semantics and device control. Unix eliminated this complexity with the concept of a data stream: an ordered sequence of data bytes which can be read until the [end of file](https://en.wikipedia.org/wiki/End-of-file "End-of-file"). A program may also write bytes as desired and need not, and cannot easily declare their count or grouping.
Another Unix breakthrough was to automatically associate input and output to terminal keyboard and terminal display, respectively, by default\[*[citation needed](https://en.wikipedia.org/wiki/Wikipedia:Citation_needed "Wikipedia:Citation needed")*\] — the program (and programmer) did absolutely nothing to establish input and output for a typical input-process-output program (unless it chose a different paradigm). In contrast, previous operating systems usually required some—often complex—[job control language](https://en.wikipedia.org/wiki/Job_Control_Language "Job Control Language") to establish connections, or the equivalent burden had to be orchestrated by the program.\[*[citation needed](https://en.wikipedia.org/wiki/Wikipedia:Citation_needed "Wikipedia:Citation needed")*\]
Since Unix provided standard streams, the Unix [C](https://en.wikipedia.org/wiki/C_\(programming_language\) "C (programming language)") runtime environment was obliged to support it as well. As a result, most C runtime environments (and [C's descendants](https://en.wikipedia.org/wiki/C_\(programming_language\)#Related_languages "C (programming language)")), regardless of the operating system, provide equivalent functionality.
## Standard input (stdin)
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=3 "Edit section: Standard input (stdin)")\]
Standard input is a stream from which a program reads its input data. The program requests data transfers by use of the *read* operation. Not all programs require stream input. For example, the *[dir](https://en.wikipedia.org/wiki/Dir_\(command\) "Dir (command)")* and *[ls](https://en.wikipedia.org/wiki/Ls "Ls")* programs (which display file names contained in a directory) may take [command-line arguments](https://en.wikipedia.org/wiki/Command-line_interface#Arguments "Command-line interface"), but perform their operations without any stream data input.
Unless [redirected](https://en.wikipedia.org/wiki/Redirection_\(computing\) "Redirection (computing)"), standard input is inherited from the parent process. In the case of an interactive shell, that is usually associated with the input device of a [terminal](https://en.wikipedia.org/wiki/Computer_terminal "Computer terminal") (or [pseudo terminal](https://en.wikipedia.org/wiki/Pseudoterminal "Pseudoterminal")) which is ultimately linked to a user's [keyboard](https://en.wikipedia.org/wiki/Keyboard_\(computing\) "Keyboard (computing)").
On [POSIX](https://en.wikipedia.org/wiki/POSIX "POSIX") systems, the [file descriptor](https://en.wikipedia.org/wiki/File_descriptor "File descriptor") for standard input is 0 (zero); the [POSIX](https://en.wikipedia.org/wiki/POSIX "POSIX") `<unistd.h>` definition is `STDIN_FILENO`; the corresponding C `<stdio.h>` abstraction is provided via the `stdin` (of type `FILE*`) global variable. Similarly in [C++](https://en.wikipedia.org/wiki/C%2B%2B "C++"), the global object `std::cin` (of type `std::istream`). provided in `<iostream>`, provides an abstraction via [C++ streams](https://en.wikipedia.org/wiki/Input/output_\(C%2B%2B\)#Input/output_streams "Input/output (C++)"). Similar abstractions exist in the standard I/O libraries of practically every [programming language](https://en.wikipedia.org/wiki/Programming_language "Programming language").
## Standard output (stdout)
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=4 "Edit section: Standard output (stdout)")\]
Standard output is a stream to which a program writes its output data. The program requests data transfer with the *write* operation. Not all programs generate output. For example, the *[file rename](https://en.wikipedia.org/wiki/Rename_\(computing\) "Rename (computing)")* command (variously called *[mv](https://en.wikipedia.org/wiki/Mv_\(Unix\) "Mv (Unix)")*, *[move](https://en.wikipedia.org/wiki/Move_\(command\) "Move (command)")*, or *[ren](https://en.wikipedia.org/wiki/Ren_\(command\) "Ren (command)")*) is silent on success.
Unless [redirected](https://en.wikipedia.org/wiki/Redirection_\(computing\) "Redirection (computing)"), standard output is inherited from the parent process. In the case of an interactive shell, that is usually the [text terminal](https://en.wikipedia.org/wiki/Text_terminal "Text terminal") which initiated the program.
The [file descriptor](https://en.wikipedia.org/wiki/File_descriptor "File descriptor") for standard output is 1 (one); the [POSIX](https://en.wikipedia.org/wiki/POSIX "POSIX") `<unistd.h>` definition is `STDOUT_FILENO`; the corresponding C `<stdio.h>` variable is `stdout` (of type `FILE*`); similarly in C++, the global object `std::cout` (of type `std::ostream`), provided in `<iostream>`, abstracts the output stream.
## Standard error (stderr)
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=5 "Edit section: Standard error (stderr)")\]
Standard error is another output stream typically used by programs to output [error messages](https://en.wikipedia.org/wiki/Error_message "Error message") or diagnostics. It is a stream independent of standard output and can be redirected separately.
This solves the [semi-predicate problem](https://en.wikipedia.org/wiki/Semipredicate_problem "Semipredicate problem"), allowing output and errors to be distinguished, and is analogous to a function returning a pair of values – see [Semipredicate problem § Multivalued return](https://en.wikipedia.org/wiki/Semipredicate_problem#Multivalued_return "Semipredicate problem"). The usual destination is the [text terminal](https://en.wikipedia.org/wiki/Text_terminal "Text terminal") which started the program to provide the best chance of being seen even if *standard output* is redirected (so not readily observed). For example, output of a program in a [pipeline](https://en.wikipedia.org/wiki/Pipeline_\(Unix\) "Pipeline (Unix)") is redirected to input of the next program or a text file, but user prompts and errors from each program still go directly to the text terminal so they can be reviewed by the user in real time.
It is acceptable and normal to direct *standard output* and *standard error* to the same destination, such as the text terminal. Messages appear in the same order as the program writes them, unless [buffering](https://en.wikipedia.org/wiki/Data_buffer "Data buffer") is involved. For example, in common situations the standard error stream is unbuffered but the standard output stream is line-buffered; in this case, text written to standard error later may appear on the terminal earlier, if the standard output stream buffer is not yet full.
The [file descriptor](https://en.wikipedia.org/wiki/File_descriptor "File descriptor") for standard error is defined by [POSIX](https://en.wikipedia.org/wiki/POSIX "POSIX") as 2 (two); the *\<unistd.h\>* header file provides the symbol `STDERR_FILENO`;[\[2\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-2) the corresponding C `<stdio.h>` variable is `stderr` (of type `FILE*`). Similarly, C++ provides two global objects associated with this stream: `std::cerr` and `std::clog` (each of type `std::ostream`), in `<iostream>`, with the former being unbuffered and the latter using the same buffering mechanism as all other C++ streams.
[Bourne](https://en.wikipedia.org/wiki/Bourne_shell "Bourne shell")\-style shells allow *standard error* to be redirected to the same destination that standard output is directed to using
```
2>&1
```
[csh](https://en.wikipedia.org/wiki/C_shell "C shell")\-style shells allow *standard error* to be redirected to the same destination that standard output is directed to using
```
>&
```
Standard error was added to Unix in the 1970s after several wasted phototypesetting runs ended with error messages being typeset instead of displayed on the user's terminal.[\[3\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-3)
[Fortran](https://en.wikipedia.org/wiki/Fortran "Fortran") has the equivalent of Unix file descriptors: By convention, many Fortran implementations use unit numbers `UNIT=5` for stdin, `UNIT=6` for stdout and `UNIT=0` for stderr. In Fortran-2003, the intrinsic `ISO_FORTRAN_ENV` module was standardized to include the named constants `INPUT_UNIT`, `OUTPUT_UNIT`, and `ERROR_UNIT` to portably specify the unit numbers.
```
! FORTRAN 77 example
PROGRAM MAIN
INTEGER NUMBER
READ(UNIT=5,*) NUMBER
WRITE(UNIT=6,'(A,I3)') ' NUMBER IS: ',NUMBER
END
```
```
! Fortran 2003 example
program main
use iso_fortran_env
implicit none
integer :: number
read (unit=INPUT_UNIT,*) number
write (unit=OUTPUT_UNIT,'(a,i3)') 'Number is: ', number
end program
```
[ALGOL 60](https://en.wikipedia.org/wiki/ALGOL_60 "ALGOL 60") was criticized for having no standard file access.\[*[citation needed](https://en.wikipedia.org/wiki/Wikipedia:Citation_needed "Wikipedia:Citation needed")*\]
[ALGOL 68](https://en.wikipedia.org/wiki/ALGOL_68 "ALGOL 68")'s input and output facilities were collectively referred to as the transput.[\[4\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-4) [Koster](https://en.wikipedia.org/wiki/Cornelis_H._A._Koster "Cornelis H. A. Koster") coordinated the definition of the *transput* standard. The model included three standard channels: `stand in`, `stand out`, and `stand back`.
| Input: | Output: |
|---|---|
An other example is the OOP language.[\[5\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-CommonBase-5): 11
```
class BASICIO (LINELENGTH); integer LINELENGTH;
begin ref (infile) SYSIN;
ref (infile) procedure sysin;
sysin :- SYSIN;
ref (printfle) SYSOUT;
ref (printfle) procedure sysout;
sysout :- SYSOUT;
class FILE ....................;
FILE class infile ............;
FILE class outfile ...........;
FILE class directfile ........;
outfile class printfle .......;
SYSIN :- new infile ("SYSIN");
SYSOUT :- new printfle ("SYSOUT");
SYSIN.open (blanks(80));
SYSOUT.open(blanks(LINELENGTH));
inner;
SYSIN.close;
SYSOUT.close;
end BASICIO;
```
In the [C programming language](https://en.wikipedia.org/wiki/C_programming_language "C programming language"), the standard input, output, and error streams are attached to the existing Unix file descriptors 0, 1 and 2 respectively.[\[6\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-6) In a [POSIX](https://en.wikipedia.org/wiki/POSIX "POSIX") environment the *\<[unistd.h](https://en.wikipedia.org/wiki/Unistd.h "Unistd.h")\>* definitions STDIN\_FILENO, STDOUT\_FILENO or STDERR\_FILENO should be used instead rather than [magic numbers](https://en.wikipedia.org/wiki/Magic_number_\(programming\) "Magic number (programming)"). File pointers stdin, stdout, and stderr are also provided.
[Ken Thompson](https://en.wikipedia.org/wiki/Ken_Thompson "Ken Thompson") (designer and implementer of the original Unix operating system) modified [sort](https://en.wikipedia.org/wiki/Sort_\(Unix\) "Sort (Unix)") in [Version 5 Unix](https://en.wikipedia.org/wiki/Version_5_Unix "Version 5 Unix") to accept "-" as representing standard input, which spread to other utilities and became a part of the operating system as a [special file](https://en.wikipedia.org/wiki/Special_file "Special file") in [Version 8](https://en.wikipedia.org/wiki/Version_8_Unix "Version 8 Unix"). Diagnostics were part of standard output through [Version 6](https://en.wikipedia.org/wiki/Version_6_Unix "Version 6 Unix"), after which [Dennis M. Ritchie](https://en.wikipedia.org/wiki/Dennis_M._Ritchie "Dennis M. Ritchie") created the concept of standard error.[\[7\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-reader-7)
In [C++](https://en.wikipedia.org/wiki/C%2B%2B "C++"), writing to standard streams was originally done using the `<iostream>` header and its streams, until the release of `<print>` which simplified input/output using print functions.[\[8\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-8) C++ inherits [C I/O facilities](https://en.wikipedia.org/wiki/C_file_input/output "C file input/output"), but it is considered more idiomatic to use the newer C++ facilities.[\[9\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-C++_stroustrup_fstrem-9)
```
#include <iostream>
#include <string>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;
using std::string;
int main() {
string input;
cout << "Write a sentence: " << endl;
cin >> input;
int inputLength = input.length();
cout << "Sentence: " << input << ", of length " << inputLength << endl;
cerr << "Sentence written to stderr: " << input << endl;
}
```
In [Java](https://en.wikipedia.org/wiki/Java_\(programming_language\) "Java (programming language)"), the standard streams are referred to by `System.in` (for stdin), `System.out` (for stdout), and `System.err` (for stderr).[\[10\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-10) It is also possible to read from any input stream using a `Scanner`.
```
package org.wikipedia.examples;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Example {
public static void main(String args[]) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s = br.readLine();
double number = Double.parseDouble(s);
System.out.printf("Number is: %d%n", number);
// Read input for a name and age:
Scanner input = new Scanner(System.in);
System.out.printf("%nEnter name: ");
String name = input.nextLine();
System.out.printf("%nEnter age: ");
int age = input.nextInt();
System.out.printf("Hello, %s! You are %d years old.", name, age);
} catch (IOException e) {
System.err.printf("Error in input/output: %s%n", e.getMessage());
} catch (Exception e) {
System.err.printf("Error: %s%n", e.getMessage());
}
}
}
```
In [C\#](https://en.wikipedia.org/wiki/C_Sharp_\(programming_language\) "C Sharp (programming language)") and other [.NET](https://en.wikipedia.org/wiki/.NET_Framework ".NET Framework") languages, the standard streams are referred to by `System.Console.In` (for stdin), `System.Console.Out` (for stdout) and `System.Console.Error` (for stderr).[\[11\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-11) Basic read and write capabilities for the stdin and stdout streams are also accessible directly through the class `System.Console` (e.g. `System.Console.WriteLine()` can be used instead of `System.Console.Out.WriteLine()`).
`System.Console.In`, `System.Console.Out` and `System.Console.Error` are respectively `System.IO.TextReader` (stdin) and `System.IO.TextWriter` (stdout, stderr) objects, which only allow access to the underlying standard streams on a text basis. Full binary access to the standard streams must be performed through the `System.IO.Stream` objects returned by `System.Console.OpenStandardInput()`, `System.Console.OpenStandardOutput()` and `System.Console.OpenStandardError()` respectively.
```
namespace Wikipeda.Examples;
using System;
public class Example {
static int Main(string[] args)
{
try
{
string s = Console.In.ReadLine();
double number = Double.Parse(s);
Console.Out.WriteLine("Number is: {0:F3}", number);
} // If Parse() threw an exception
catch (ArgumentNullException e)
{
Console.Error.WriteLine($"No number was entered: {e.Message}");
return 1;
}
catch (FormatException e)
{
Console.Error.WriteLine($"The specified value is not a valid number: {e.Message}");
return 2;
}
catch (OverflowException e)
{
Console.Error.WriteLine($"The specified number is too big: {e.Message}");
return 3;
}
catch (Exception ex)
{
Console.Error.WriteLine($"An unknown exception occurred: {e.Message}");
return -1;
}
return 0;
}
```
```
' Visual Basic .NET example
Public Function Main() As Integer
Try
Dim s As String = System.Console.[In].ReadLine()
Dim number As Double = Double.Parse(s)
System.Console.Out.WriteLine("Number is: {0:F3}", number)
Return 0
' If Parse() threw an exception
Catch ex As System.ArgumentNullException
System.Console.[Error].WriteLine("No number was entered!")
Catch ex2 As System.FormatException
System.Console.[Error].WriteLine("The specified value is not a valid number!")
Catch ex3 As System.OverflowException
System.Console.[Error].WriteLine("The specified number is too big!")
End Try
Return -1
End Function
```
When applying the `System.Diagnostics.Process` [class](https://en.wikipedia.org/wiki/Class_\(computer_science\) "Class (computer science)") one can use the instance [properties](https://en.wikipedia.org/wiki/Property_\(programming\) "Property (programming)") `StandardInput`, `StandardOutput`, and `StandardError` of that class to access the standard streams of the process.
### 2000s onward: Python, C++
\[[edit](https://en.wikipedia.org/w/index.php?title=Standard_streams&action=edit§ion=14 "Edit section: 2000s onward: Python, C++")\]
The following example, written in [Python](https://en.wikipedia.org/wiki/Python_\(programming_language\) "Python (programming language)"), shows how to redirect the standard input both to the standard output and to a text file.
```
#!/usr/bin/env python
import sys
from typing import TextIO
if __name__ == "__main__":
# Save the current stdout so that we can revert sys.stdout
# after we complete our redirection
stdin_fileno: TextIO = sys.stdin
stdout_fileno: TextIO = sys.stdout
# Redirect sys.stdout to the file
sys.stdout: TextIO = open("myfile.txt", "w")
ctr: int = 0
for inps in stdin_fileno:
ctrs: str = str(ctr)
# Prints to the redirected stdout ()
sys.stdout.write(f"{ctrs}) this is to the redirected --->{inps}\n")
# Prints to the actual saved stdout handler
stdout_fileno.write(f"{ctrs}) this is to the actual --->{inps}\n")
ctr = ctr + 1
# Close the file
sys.stdout.close()
# Restore sys.stdout to our old saved file handler
sys.stdout = stdout_fileno
```
In [C++23](https://en.wikipedia.org/wiki/C%2B%2B23 "C++23"), an updated printing interface was created for writing to the output stream, using `std::print` functions.[\[12\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-12)
```
import std;
using std::string;
int main() {
string s = "Hello, world!";
std::println(stdout, "My string: {}", s);
std::println(stderr, "String to error stream: {}", s);
}
```
[Graphical user interfaces](https://en.wikipedia.org/wiki/Graphical_user_interface "Graphical user interface") (GUIs) do not always make use of the standard streams; they do when GUIs are wrappers of underlying scripts and/or console programs, for instance the [Synaptic](https://en.wikipedia.org/wiki/Synaptic_\(software\) "Synaptic (software)") package manager GUI, which wraps apt commands in Debian and/or Ubuntu. GUIs created with scripting tools like Zenity and KDialog by [KDE](https://en.wikipedia.org/wiki/KDE "KDE") project[\[13\]](https://en.wikipedia.org/wiki/Standard_streams#cite_note-13) make use of stdin, stdout, and stderr, and are based on simple scripts rather than a complete GUI programmed and compiled in C/C++ using [Qt](https://en.wikipedia.org/wiki/Qt_\(software\) "Qt (software)"), [GTK](https://en.wikipedia.org/wiki/GTK "GTK"), or other equivalent proprietary widget framework.
The [Services menu](https://en.wikipedia.org/wiki/Services_menu "Services menu"), as implemented on [NeXTSTEP](https://en.wikipedia.org/wiki/NeXTSTEP "NeXTSTEP") and [Mac OS X](https://en.wikipedia.org/wiki/Mac_OS_X "Mac OS X"), is also analogous to standard streams. On these operating systems, graphical applications can provide functionality through a system-wide menu that operates on the current [selection](https://en.wiktionary.org/wiki/selection "wikt:selection") in the GUI, no matter in what application.
Some GUI programs, primarily on Unix, still write debug information to standard error. Others (such as many Unix media players) may read files from standard input. Popular Windows programs that open a separate console window in addition to their GUI windows are the emulators [pSX](https://en.wikipedia.org/w/index.php?title=PSX_\(emulator\)&action=edit&redlink=1 "PSX (emulator) (page does not exist)") and [DOSBox](https://en.wikipedia.org/wiki/DOSBox "DOSBox").
[GTK-server](https://en.wikipedia.org/wiki/GTK-server "GTK-server") can use stdin as a communication interface with an interpreted program to realize a GUI.
The [Common Lisp Interface Manager](https://en.wikipedia.org/wiki/CLIM "CLIM") paradigm "presents" GUI elements sent to an extended output stream.
- [Redirection](https://en.wikipedia.org/wiki/Redirection_\(computing\) "Redirection (computing)")
- [Stream](https://en.wikipedia.org/wiki/Stream_\(computing\) "Stream (computing)")
- [Input/output](https://en.wikipedia.org/wiki/Input/output "Input/output")
- [C file input/output](https://en.wikipedia.org/wiki/C_file_input/output "C file input/output")
- [SYSIN](https://en.wikipedia.org/wiki/SYSIN "SYSIN") and [SYSOUT](https://en.wikipedia.org/wiki/SYSOUT "SYSOUT")
- [Standard streams in the Files-11 file system](https://en.wikipedia.org/wiki/Files-11#Logical_names "Files-11")
1. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-1)** D. M. Ritchie, ["A Stream Input-Output System"](https://cseweb.ucsd.edu/classes/fa01/cse221/papers/ritchie-stream-io-belllabs84.pdf), AT\&T Bell Laboratories Technical Journal, 68(8), October 1984.
2. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-2)**
["\<unistd.h\>"](http://pubs.opengroup.org/onlinepubs/009695399/basedefs/unistd.h.html). *The Open Group Base Specifications Issue 6—IEEE Std 1003.1, 2004 Edition*. The Open Group. 2004.
3. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-3)**
[Johnson, Steve](https://en.wikipedia.org/wiki/Stephen_C._Johnson "Stephen C. Johnson") (2013-12-11). ["\[TUHS\] Graphic Systems C/A/T phototypesetter"](https://minnie.tuhs.org/pipermail/tuhs/2013-December/006113.html) (Mailing list). [Archived](https://web.archive.org/web/20200925010614/https://minnie.tuhs.org/pipermail/tuhs/2013-December/006113.html) from the original on 2020-09-25. Retrieved 2020-11-07.
4. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-4)** "[Revised Report on the Algorithmic Language Algol 68](http://www.softwarepreservation.org/projects/ALGOL/report/Algol68_revised_report-AB.pdf)", edited by A. van Wijngaarden, B.J. Mailloux, J.E.L. Peck, C.H.A. Koster, M. Sintzoff, C.H. Lindsey, L.G.L.T. Meertens and R.G. Fisker, Section 10.3.
5. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-CommonBase_5-0)**
[Dahl, Ole-Johan](https://en.wikipedia.org/wiki/Ole-Johan_Dahl "Ole-Johan Dahl"); Myhrhaug, Bjørn; [Nygaard, Kristen](https://en.wikipedia.org/wiki/Kristen_Nygaard "Kristen Nygaard") (1970). [Common Base Language](https://web.archive.org/web/20240919044713/https://www.softwarepreservation.org/projects/ALGOL/manual/Simula-CommonBaseLanguage.pdf) (PDF) (Report). Norwegian Computing Center. Archived from the original on 2024-09-19. Retrieved 20 August 2025.
6. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-6)**
["Stdin(3): Standard I/O streams - Linux man page"](http://linux.die.net/man/3/stdin). *die.net*. [Archived](https://web.archive.org/web/20230608111413/https://linux.die.net/man/3/stdin) from the original on Jun 8, 2023.
7. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-reader_7-0)**
[McIlroy, M. D.](https://en.wikipedia.org/wiki/Doug_McIlroy "Doug McIlroy") (1987). [*A Research Unix reader: annotated excerpts from the Programmer's Manual, 1971–1986*](http://www.cs.dartmouth.edu/~doug/reader.pdf) (PDF) (Technical report). CSTR. Bell Labs. 139. [Archived](https://web.archive.org/web/20231215143742/https://www.cs.dartmouth.edu/~doug/reader.pdf) (PDF) from the original on Dec 15, 2023.
8. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-8)**
Bjarne Stroustrup. ["A History of C++: 1979–1991"](http://www.stroustrup.com/hopl2.pdf) (PDF).
9. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-C++_stroustrup_fstrem_9-0)**
Bjarne Stroustrup (1997). [*The C++ programming language*](https://archive.org/details/cprogramminglang00stro_0/page/637) (third ed.). Addison-Wesley. pp. [637–640](https://archive.org/details/cprogramminglang00stro_0/page/637). [ISBN](https://en.wikipedia.org/wiki/ISBN_\(identifier\) "ISBN (identifier)")
[0-201-88954-4](https://en.wikipedia.org/wiki/Special:BookSources/0-201-88954-4 "Special:BookSources/0-201-88954-4")
.
10. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-10)**
["System (Java Platform SE 7)"](http://docs.oracle.com/javase/7/docs/api/java/lang/System.html). *Oracle Help Center*. Retrieved 20 July 2012.
11. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-11)**
[".NET Framework 4.7.1, mscorlib, console.cs"](https://referencesource.microsoft.com/#mscorlib/system/console.cs,34). *Reference Source - Microsoft*. [Archived](https://web.archive.org/web/20171210072215/https://referencesource.microsoft.com/#mscorlib/system/console.cs,34) from the original on Dec 10, 2017. Retrieved 2017-12-10.
12. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-12)**
Victor Zverovich (25 March 2022). ["Formatted output"](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2093r14.html). *open-std.org*. WG 21.
13. **[^](https://en.wikipedia.org/wiki/Standard_streams#cite_ref-13)**
Kißling, Kristian (2009). ["Adding graphic elements to your scripts with Zenity and KDialog"](https://www.linux-magazine.com/Issues/2009/99/Zenity-and-KDialog). *[Linux Magazine](https://en.wikipedia.org/wiki/Linux_Magazine "Linux Magazine")*. Retrieved 2021-04-11.
- "[Standard Streams](https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html)", [The GNU C Library](https://www.gnu.org/software/libc/manual/html_node/index.html)
- *KRONOS 2.1 Reference Manual*, Control Data Corporation, Part Number 60407000, 1974
- *NOS Version 1 Applications Programmer's Instant*, Control Data Corporation, Part Number 60436000, 1978
- [Level 68 Introduction to Programming on MULTICS](http://www.bitsavers.org/pdf/honeywell/multics/AG90-03_PgmgIntro_Dec81.pdf) [Archived](https://web.archive.org/web/20210225022744/http://www.bitsavers.org/pdf/honeywell/multics/AG90-03_PgmgIntro_Dec81.pdf) 2021-02-25 at the [Wayback Machine](https://en.wikipedia.org/wiki/Wayback_Machine "Wayback Machine"), Honeywell Corporation, 1981
- [Evolution of the MVS Operating System](https://web.archive.org/web/20191009002342/https://pdfs.semanticscholar.org/a8e4/4d068a376c42513a4e10d6a751702710afee.pdf), IBM Corporation, 1981
- *Lions' Commentary on UNIX Sixth Edition*, John Lions, [ISBN](https://en.wikipedia.org/wiki/ISBN_\(identifier\) "ISBN (identifier)")
[1-57398-013-7](https://en.wikipedia.org/wiki/Special:BookSources/1-57398-013-7 "Special:BookSources/1-57398-013-7")
, 1977
- [Console Class, .NET Framework Class Library](http://msdn2.microsoft.com/en-us/library/system.console.aspx), Microsoft Corporation, 2008
- [Standard Input Definition](http://www.linfo.org/standard_input.html) - by The Linux Information Project
- [Standard Output Definition](http://www.linfo.org/standard_output.html) - by The Linux Information Project
- [Standard Error Definition](http://www.linfo.org/standard_error.html) - by The Linux Information Project |
| Shard | 152 (laksa) |
| Root Hash | 17790707453426894952 |
| Unparsed URL | org,wikipedia!en,/wiki/Standard_streams s443 |