Jump to content

Standard streams

From Simple English Wikipedia, the free encyclopedia

In computer programming, standard streams are data streams (a sequence of continuous data). They allow computer programs to exchange information through input and output with their environment while running. The environment that programs interact with when using standard streams is commonly a terminal. The three most common standard streams are standard input, standard output and standard error. These are often shortened to stdin, stdout and stderr.

When a process (a running program) is created, these streams are automatically opened to the process. On Unix systems, the streams can be used by processes as files. The process may read or write from the streams. It may also open or close them.

When using some shells, streams may be controlled and passed between different processes or files. See Redirection (computing).

Usage with a terminal

[change | change source]

If a program wants to write a character the screen, it would write to stdout. Then, the terminal would read from stdout and it would eventually be shown to the screen for the user.

A process would take user input similarly by reading from stdin.