std.console Package
Function Description
The console
package provides methods for interacting with standard input, standard output, and standard error streams.
This package provides the Console class for obtaining the three standard streams.
- ConsoleReader encapsulates the functions related to standard input streams. You can use the
read
method to read data from standard input streams. - ConsoleWriter encapsulates functions related to standard output and standard error streams. ConsoleWriter encapsulates a series of
write
methods and provides the capability of writing data to standard output and standard error streams.
Standard input (stdin), standard output (stdout), and standard error (stderr) are three common streams in computer operating systems.
A standard input stream is that a program obtains input data from a user, and is usually a keyboard input. A standard output stream is that a program outputs results to a user, and is usually a screen output. A standard error stream is that a program outputs error information when an error occurs, and is usually a screen output.
On Unix or Linux, standard input, standard output, and standard error correspond to file descriptors 0, 1, and 2, respectively. Programs can use these file descriptors to read and write data. For example, redirection symbols can be used to redirect a standard output to a file, or to redirect a standard error output to a standard input of another program.
API List
Class
Name | Description |
---|---|
Console | Provides APIs for obtaining standard input, standard output, and standard error streams. |
ConsoleReader | Provides functions of reading characters or strings from standard input streams. |
ConsoleWriter | Provides functions of writing characters or strings to standard output or standard error streams. |