Standard Input/Output/Error
Programs need to get input, and output results or error messages if any. In Unix-like systems such as GNU/Linux, the system provides the interfaces, or links for those purposes.
- The link for input is called standard input. By default, it is connected to the keyboard.
- The link for normal output is called standard output. By default, it is connected to the screen.
- The link for error message output is called standard error. By default, it is also connected to the screen.
In Unix-like systems, everything is treated as a file. every file has a file descriptor (an index number). So are standard input, output, and error.
File | Descriptor |
---|---|
stdin | 0 |
stdout | 1 |
stderr | 2 |
The endpoints, or files, they connect to can be changed, this action is called redirection.
Comments
Post a Comment