IO - Standard streams (stdin, stdout, stderr)

Card Puncher Data Processing

About

Standard Streams are the mechanism by which a process:

  • receive data (stdin)
  • and output data (stdout, stderr).

At the command line (Repl, Shell)

In a shell, by default, they will:

  • read input from the keyboard
  • and write output to the display.

They are the building block of interaction with the user in a command line environment. The application catch them and manipulate them to interact with the user or other programs.

List

The three I/O connections are called:

  • standard input (stdin) - Read from the keyboard or from a redirection such as the pipe.
  • standard output (stdout) - Print to the display and can be redirected as standard input.
  • and standard error (stderr) - Same as stdout but normally only for errors. Having error output separately allows the user to divert regular output to a file and still be able to read error messages.

Implementation

They are open files that point to the standard input, standard output, and standard error file descriptors.

They are properties of every process

Language

Language stdin stdout stderr
Java System.in System.out System.err
C Unix file descriptors 0 Unix file descriptors 1 Unix file descriptors 2
Bash (Shell) stdin /dev/stdout stderr

Method

Redirection

Standard streams also support I/O on files and between programs, but that feature is controlled by the command line interpreter, not the program.

See What are Shell Redirections? of Standard Streams





Discover More
Card Puncher Data Processing
Ant - Logger

Loggers extend the capabilities of listeners and add the following features: Receives a handle to the standard output and error print streams and therefore can log information to the console or the...
Bash Liste Des Attaques Ovh
Bash - Echo (Built-in Command)

Echo in bash. Echo accepts an argument (a literal string or a variable) as standard input, and echoes it back to the terminal as standard output. In Bash, it's available as: the builtin bash command...
Bash Liste Des Attaques Ovh
Bash - process

This article is the bash Process. To see how to manage another general linux process, see The process running the command is created. The process inherits the stdin, stdout, and stderr from...
Card Puncher Data Processing
Command Line (Interpreter|Interface)

A command line interpreter is a interpreter that executes commands at the console in a interactive way via the REPL paradigm in a script A command line interpreter is also known as: command line...
Process Explorer Handle Open File Search
File System - File Descriptor or Handle (Open File)

A file descriptor (Unix, Linux) or a file handle (Windows) is the connection id (generally to a file) from the Operating system in order to perform IO operations (Input/Ouput of Bytes). For Wikipedia,...
Card Puncher Data Processing
Go - Standard Stream (stdin, stdout, stderr)

in Go Equivalent to cat. Take the standard input and print it to standard output ' stdout is a file that is printed immediately to the screen by the console.
Bash Liste Des Attaques Ovh
How to return two variables or more from a bash function?

This article shows you how you can return 2 or more variables from a bash function. Within your shell (remotely mostly within putty) Edit it with your favorite edition technique and add the bash...
Card Puncher Data Processing
How to run a docker image with example to create a container?

The run command creates: a container from an image running the docker host and calls the entrypoint script with the cmd values as arguments start To generate this message, Docker took...
Io Input Stream
I/O - Stream

A stream concept at the io level is a file (generally a text file) A stream is an abstract concept for files and io devices which can be read or written, or sometimes both. I/O devices can be interpreted...
Card Puncher Data Processing
IO - Standard Input (stdin)

Standard Input is a standard stream that reads: from the keyboard or from a redirection such as the pipe.



Share this page:
Follow us:
Task Runner