Represents the standard input, output, and error streams for console applications.
Public Fields | |
| static std::ostream | error |
| Gets the error output stream. A std::basic_ostream<char_t> that represents the error output stream. | |
| static std::istream | in |
| Gets the standard input stream. A std::basic_istream<char_t> that represents the standard input stream. | |
| static std::ostream | out |
| Gets the standard output stream. A std::basic_ostream<char_t> that represents the standard output stream. | |
Public Static Events | |
| static event< console, console_cancel_event_handler > | cancel_key_press |
| Occurs when the Control modifier key (Ctrl) and either the ConsoleKey.C console key (C) or the Break key are pressed simultaneously (Ctrl+C or Ctrl+Break). | |
Public Static Properties | |
| static bool | auto_flush_out () |
| Gets a value indicating whether the xtd::console::out will flush its buffer to the underlying stream after every call to xtd::console::write and xtd::console::write_line. | |
| static void | auto_flush_out (bool value) |
| Sets a value indicating whether the xtd::console::out will flush its buffer to the underlying stream after every call to xtd::console::write and xtd::console::write_line. | |
| static console_color | background_color () |
| Gets the background color of the console. | |
| static void | background_color (console_color color) |
| Sets the background color of the console. | |
| static int32 | buffer_height () |
| Gets the height of the buffer area. | |
| static void | buffer_height (int32 height) |
| Sets or sets the height of the buffer area. | |
| static int32 | buffer_width () |
| Gets the width of the buffer area. | |
| static void | buffer_width (int32 width) |
| Sets the width of the buffer area. | |
| static bool | caps_lock () |
| Gets a value indicating whether the CAPS LOCK keyboard toggle is turned on or turned off. | |
| static int32 | cursor_left () |
| Gets the column position of the cursor within the buffer area. | |
| static void | cursor_left (int32 left) |
| Sets the column position of the cursor within the buffer area. | |
| static int32 | cursor_size () |
| Gets or sets the height of the cursor within a character cell. | |
| static void | cursor_size (int32 size) |
| Sets the height of the cursor within a character cell. | |
| static int32 | cursor_top () |
| Gets the row position of the cursor within the buffer area. | |
| static void | cursor_top (int32 top) |
| Sets the row position of the cursor within the buffer area. | |
| static bool | cursor_visible () |
| Gets a value indicating whether the cursor is visible. | |
| static void | cursor_visible (bool visible) |
| Sets a value indicating whether the cursor is visible. | |
| static console_color | foreground_color () |
| Gets the foreground color of the console. | |
| static bool | foreground_color (console_color color) |
| Sets the foreground color of the console. | |
| static int32 | input_code_page () |
| Gets the code page the console uses to read input. | |
| static void | input_code_page (int32 code_page) |
| Sets the code page the console uses to read input. | |
| static bool | is_error_redirected () |
| Gets a value that indicates whether the error output stream has been redirected from the standard error stream. | |
| static bool | is_input_redirected () |
| Gets a value that indicates whether the input stream has been redirected from the standard input stream. | |
| static bool | is_output_redirected () |
| Gets a value that indicates whether the output stream has been redirected from the standard output stream. | |
| static bool | key_available () |
| Gets a value indicating whether a key press is available in the input stream. | |
| static int32 | largest_window_height () |
| Gets the largest possible number of console window rows, based on the current font and screen resolution. | |
| static int32 | largest_window_width () |
| Gets the largest possible number of console window columns, based on the current font and screen resolution. | |
| static bool | number_lock () |
| Gets a value indicating whether the NUM LOCK keyboard toggle is turned on or turned off. | |
| static int32 | output_code_page () |
| Gets the code page the console uses to write output. | |
| static void | output_code_page (int32 code_page) |
| Sets the code page the console uses to write output. | |
| static xtd::string | title () |
| Gets the title to display in the console title bar. | |
| static void | title (const xtd::string &title) |
| Sets the title to display in the console title bar. | |
| static bool | treat_control_c_as_input () |
| Gets a value indicating whether the combination of the Control modifier key and C console key (Ctrl+C) is treated as ordinary input or as an interruption that is handled by the operating system. | |
| static void | treat_control_c_as_input (bool treat_control_c_as_input) |
| Sets a value indicating whether the combination of the Control modifier key and C console key (Ctrl+C) is treated as ordinary input or as an interruption that is handled by the operating system. | |
| static int32 | window_height () |
| Gets the height of the console window area. | |
| static void | window_height (int32 height) |
| Sets the height of the console window area. | |
| static int32 | window_left () |
| Gets the left of the console window area. | |
| static void | window_left (int32 left) |
| Sets the left of the console window area. | |
| static int32 | window_top () |
| Gets the top of the console window area. | |
| static void | window_top (int32 top) |
| Sets the top of the console window area. | |
| static int32 | window_width () |
| Gets the width of the console window area. | |
| static void | window_width (int32 width) |
| Sets the width of the console window area. | |
Public Static Methods | |
| static void | beep () |
| Plays the sound of a beep through the console speaker. | |
| static void | beep (uint32 frequency, uint32 duration) |
| Plays the sound of a beep of a specified frequency and duration through the console speaker. | |
| static void | clear () |
| Clears the console buffer and corresponding console window of display information. | |
| static xtd::collections::generic::key_value_pair< int32, int32 > | get_cursor_position () |
| Gets the position of the cursor. | |
| static std::ostream | open_standard_error () |
| Acquires the standard error stream. | |
| static std::istream | open_standard_input () |
| Acquires the standard input stream. | |
| static std::ostream | open_standard_output () |
| Acquires the standard output stream. | |
| static int32 | read () |
| Reads the next character from the standard input stream. | |
| static console_key_info | read_key () |
| Obtains the next character or function key pressed by the user. The pressed key is displayed in the console window. | |
| static console_key_info | read_key (bool intercept) |
| Obtains the next character or function key pressed by the user. The pressed key is optionally displayed in the console window. | |
| static xtd::string | read_line () |
| Reads the next line of characters from the standard input stream. | |
| static xtd::string | read_line (bool intercept) |
| Reads the next line of characters from the standard input stream. | |
| static bool | reset_color () |
| Sets the foreground and background console colors to their defaults. | |
| static void | set_cursor_position (int32 left, int32 top) |
| Sets the position of the cursor. | |
| static void | set_error (const std::ostream &os) |
| Sets the error property to the specified std::ostream object. | |
| static void | set_in (const std::istream &is) |
| Sets the int property to the specified std::istream object. | |
| static void | set_out (const std::ostream &os) |
| Sets the out property to the specified std::ostream object. | |
| static void | set_window_position (int32 left, int32 top) |
| Sets the position of the console window relative to the screen buffer. | |
| static void | set_window_size (int32 width, int32 height) |
| Sets the height and width of the console window to the specified values. | |
| template<class arg_t> | |
| static void | write (arg_t &&value) |
| Writes the text representation of the specified value to the standard output stream. | |
| template<class ... args_t> | |
| static void | write (const xtd::string &fmt, args_t &&... values) |
| Writes the text representation of the specified list of values to the standard output stream using the specified format information. | |
| static void | write_line () |
| Writes the current line terminator to the standard output stream using the specified format information. | |
| template<class arg_t> | |
| static void | write_line (arg_t &&value) |
| Writes the text representation of the specified value, followed by the current line terminator, to the standard output stream. | |
| template<class ... args_t> | |
| static void | write_line (const xtd::string &fmt, args_t &&... values) |
| Writes the text representation of the specified list of values, followed by the current line terminator, to the standard output stream using the specified format information. | |
|
static |
Gets a value indicating whether the xtd::console::out will flush its buffer to the underlying stream after every call to xtd::console::write and xtd::console::write_line.
true to force xtd::console::out to flush its buffer; otherwise, false. The default value is true.
|
static |
Sets a value indicating whether the xtd::console::out will flush its buffer to the underlying stream after every call to xtd::console::write and xtd::console::write_line.
| value | true to force xtd::console::out to flush its buffer; otherwise, false. The default value is true. |
|
static |
Gets the background color of the console.
|
static |
Sets the background color of the console.
| color | A xtd::console_color that specifies the background color of the console; that is, the color that appears behind each character. |
| xtd::argument_exception | The color specified in a set operation is not a valid member of xtd::console_color. |
|
static |
Gets the height of the buffer area.
|
static |
Sets or sets the height of the buffer area.
| height | The current height, in rows, of the buffer area. |
| xtd::argument_out_of_range_exception | The value in a set operation is less than or equal to zero. -or- The value in a set operation is greater than or equal to xtd::int16_object::max_value. |
|
static |
Gets the width of the buffer area.
|
static |
Sets the width of the buffer area.
| width | The current width, in columns, of the buffer area. |
| xtd::argument_out_of_range_exception | The value in a set operation is less than or equal to zero. -or- The value in a set operation is greater than or equal to xtd::int16_object::max_value. |
|
static |
Gets a value indicating whether the CAPS LOCK keyboard toggle is turned on or turned off.
true if CAPS LOCK is turned on; false if CAPS LOCK is turned off.
|
static |
Gets the column position of the cursor within the buffer area.
|
static |
Sets the column position of the cursor within the buffer area.
| left | The current position, in columns, of the cursor. |
| xtd::argument_out_of_range_exception | The value in a set operation is less than zero -or- The value in a set operation is greater than or equal to xtd::console::buffer_width. |
|
static |
Gets or sets the height of the cursor within a character cell.
|
static |
Sets the height of the cursor within a character cell.
| size | The size of the cursor expressed as a percentage of the height of a character cell. The property value ranges from 1 to 100. |
| xtd::argument_out_of_range_exception | The value specified in a set operation is less than 1 or greater than 100. |
|
static |
Gets the row position of the cursor within the buffer area.
|
static |
Sets the row position of the cursor within the buffer area.
| top | The current position, in rows, of the cursor. |
true if cursor top changed; otherwise false. | xtd::argument_out_of_range_exception | The value in a set operation is less than zero -or- The value in a set operation is greater than or equal to xtd::console::buffer_height. |
|
static |
Gets a value indicating whether the cursor is visible.
true if the cursor is visible; otherwise, false.
|
static |
Sets a value indicating whether the cursor is visible.
| visible | true if the cursor is visible; otherwise, false. |
|
static |
Gets the foreground color of the console.
|
static |
Sets the foreground color of the console.
| color | A console_color that specifies the foreground color of the console; that is, the color of each character that is displayed. |
| xtd::argument_exception | The color specified in a set operation is not a valid member of xtd::console_color. |
|
static |
Gets the code page the console uses to read input.
| xtd::io::io_exception | An error occurred during the execution of this operation. |
| Code page | Name | Display name |
|---|---|---|
| 1200 | utf-16 | Unicode |
| 1201 | utf-16BE | Unicode (Big endian) |
| 12000 | utf-32 | Unicode (UTF-32) |
| 12001 | utf-32BE | Unicode (UTF-32 Big endian) |
| 20127 | us-ascii | US-ASCII |
| 28591 | iso-8859-1 | Western European (ISO) |
| 65000 | utf-7 | Unicode (UTF-7) |
| 65001 | utf-8 | Unicode (UTF-8) |
|
static |
Sets the code page the console uses to read input.
| code_page | The code page used to read console input. |
| xtd::io::io_exception | An error occurred during the execution of this operation. |
| Code page | Name | Display name |
|---|---|---|
| 1200 | utf-16 | Unicode |
| 1201 | utf-16BE | Unicode (Big endian) |
| 12000 | utf-32 | Unicode (UTF-32) |
| 12001 | utf-32BE | Unicode (UTF-32 Big endian) |
| 20127 | us-ascii | US-ASCII |
| 28591 | iso-8859-1 | Western European (ISO) |
| 65000 | utf-7 | Unicode (UTF-7) |
| 65001 | utf-8 | Unicode (UTF-8) |
|
static |
Gets a value that indicates whether the error output stream has been redirected from the standard error stream.
true if error output is redirected; otherwise, false.
|
static |
Gets a value that indicates whether the input stream has been redirected from the standard input stream.
true if input is redirected; otherwise, false.
|
static |
Gets a value that indicates whether the output stream has been redirected from the standard output stream.
true if output is redirected; otherwise, false.
|
static |
Gets a value indicating whether a key press is available in the input stream.
true if a key press is available; otherwise, false.
|
static |
Gets the largest possible number of console window rows, based on the current font and screen resolution.
|
static |
Gets the largest possible number of console window columns, based on the current font and screen resolution.
|
static |
Gets a value indicating whether the NUM LOCK keyboard toggle is turned on or turned off.
true if NUM LOCK is turned on; false if NUM LOCK is turned off.
|
static |
Gets the code page the console uses to write output.
| xtd::io::io_exception | An error occurred during the execution of this operation. |
| Code page | Name | Display name |
|---|---|---|
| 1200 | utf-16 | Unicode |
| 1201 | utf-16BE | Unicode (Big endian) |
| 12000 | utf-32 | Unicode (UTF-32) |
| 12001 | utf-32BE | Unicode (UTF-32 Big endian) |
| 20127 | us-ascii | US-ASCII |
| 28591 | iso-8859-1 | Western European (ISO) |
| 65000 | utf-7 | Unicode (UTF-7) |
| 65001 | utf-8 | Unicode (UTF-8) |
|
static |
Sets the code page the console uses to write output.
| code_page | The code page used to write console output. |
| xtd::io::io_exception | An error occurred during the execution of this operation. |
| Code page | Name | Display name |
|---|---|---|
| 1200 | utf-16 | Unicode |
| 1201 | utf-16BE | Unicode (Big endian) |
| 12000 | utf-32 | Unicode (UTF-32) |
| 12001 | utf-32BE | Unicode (UTF-32 Big endian) |
| 20127 | us-ascii | US-ASCII |
| 28591 | iso-8859-1 | Western European (ISO) |
| 65000 | utf-7 | Unicode (UTF-7) |
| 65001 | utf-8 | Unicode (UTF-8) |
|
static |
Gets the title to display in the console title bar.
|
static |
Sets the title to display in the console title bar.
| title | The string to be displayed in the title bar of the console. The maximum length of the title string is 24500 characters. |
|
static |
Gets a value indicating whether the combination of the Control modifier key and C console key (Ctrl+C) is treated as ordinary input or as an interruption that is handled by the operating system.
true if Ctrl+C is treated as ordinary input; otherwise, false. false and Ctrl+C is pressed, the pressed keys are not stored in the input buffer and the operating system terminates the currently executing process. This is the default value. true has such a dramatic effect. Most users expect Ctrl+C to terminate a console application. If you disable the effect of Ctrl+C, the user must remember to use Ctrl+Break to terminate the application, which is a less familiar key combination.
|
static |
Sets a value indicating whether the combination of the Control modifier key and C console key (Ctrl+C) is treated as ordinary input or as an interruption that is handled by the operating system.
| treat_control_c_as_input | true if Ctrl+C is treated as ordinary input; otherwise, false. |
false and Ctrl+C is pressed, the pressed keys are not stored in the input buffer and the operating system terminates the currently executing process. This is the default value. true has such a dramatic effect. Most users expect Ctrl+C to terminate a console application. If you disable the effect of Ctrl+C, the user must remember to use Ctrl+Break to terminate the application, which is a less familiar key combination.
|
static |
Gets the height of the console window area.
|
static |
Sets the height of the console window area.
| height | The height of the console window measured in rows. |
|
static |
Gets the left of the console window area.
|
static |
Sets the left of the console window area.
| left | The left of the console window measured in columns. |
|
static |
Gets the top of the console window area.
|
static |
Sets the top of the console window area.
| top | The top of the console window measured in rows. |
|
static |
Gets the width of the console window area.
|
static |
Sets the width of the console window area.
| width | The width of the console window measured in columns. |
|
static |
Plays the sound of a beep through the console speaker.
Plays the sound of a beep of a specified frequency and duration through the console speaker.
| frequency | The frequency of the beep, ranging from 37 to 32767 hertz |
| duration | The duration of the beep measured in milliseconds |
|
static |
Clears the console buffer and corresponding console window of display information.
|
static |
Gets the position of the cursor.
|
static |
Acquires the standard error stream.
|
static |
Acquires the standard input stream.
|
static |
Acquires the standard output stream.
|
static |
Reads the next character from the standard input stream.
|
static |
Obtains the next character or function key pressed by the user. The pressed key is displayed in the console window.
|
static |
Obtains the next character or function key pressed by the user. The pressed key is optionally displayed in the console window.
| intercept | Determines whether to display the pressed key in the console window. true to not display the pressed key; otherwise, false |
|
static |
Reads the next line of characters from the standard input stream.
|
static |
Reads the next line of characters from the standard input stream.
| intercept | Determines whether to display the pressed key in the console window. true to not display the pressed key; otherwise, false |
|
static |
Sets the foreground and background console colors to their defaults.
Sets the position of the cursor.
| left | The column position of the cursor. Columns are numbered from left to right starting at 0. |
| top | The row position of the cursor. Rows are numbered from top to bottom starting at 0. |
| xtd::argument_out_of_range_exception | The left in a set operation is less than zero -or- The left in a set operation is greater than or equal to xtd::console::buffer_width -or- the top in a set operation is less than zero -or- The topo in a set operation is greater than or equal to xtd::console::buffer_height. |
|
static |
Sets the error property to the specified std::ostream object.
| os | A stream that is the new standard error output. |
|
static |
Sets the int property to the specified std::istream object.
| os | A stream that is the new standard input. |
|
static |
Sets the out property to the specified std::ostream object.
| os | A stream that is the new standard output. |
Sets the position of the console window relative to the screen buffer.
| left | The column position of the upper left corner of the console window. |
| top | The row position of the upper left corner of the console window. |
| xtd::argument_out_of_range_exception | The left in a set operation is less than zero -or- The left in a set operation is greater than or equal to xtd::console::buffer_width -or- the top in a set operation is less than zero -or- The topo in a set operation is greater than or equal to xtd::console::buffer_height. |
Sets the height and width of the console window to the specified values.
| width | The width of the console window measured in columns. |
| height | The height of the console window measured in rows. |
| xtd::argument_out_of_range_exception | width or height is less than or equal to zero. -or- width plus WindowLeft or height plus WindowTop is greater than or equal to xtd::int16_object.max_value. -or- width or height is greater than the largest possible window width or height for the current screen resolution and console font. |
|
inlinestatic |
Writes the text representation of the specified value to the standard output stream.
| arg_t | The type of the value to write. |
| value | The value to write, |
|
inlinestatic |
Writes the text representation of the specified list of values to the standard output stream using the specified format information.
| ...args_t | Types of the values to write. |
| fmt | A composite format string. |
| values | Values to write, |
|
static |
Writes the current line terminator to the standard output stream using the specified format information.
|
inlinestatic |
Writes the text representation of the specified value, followed by the current line terminator, to the standard output stream.
| arg_t | The type of the value to write. |
| value | The value to write, |
|
inlinestatic |
Writes the text representation of the specified list of values, followed by the current line terminator, to the standard output stream using the specified format information.
| ...args_t | Types of the values to write. |
| fmt | A composite format string. |
| values | Values to write, |
|
static |
Gets the error output stream. A std::basic_ostream<char_t> that represents the error output stream.
|
static |
Gets the standard input stream. A std::basic_istream<char_t> that represents the standard input stream.
|
static |
Gets the standard output stream. A std::basic_ostream<char_t> that represents the standard output stream.
|
static |
Occurs when the Control modifier key (Ctrl) and either the ConsoleKey.C console key (C) or the Break key are pressed simultaneously (Ctrl+C or Ctrl+Break).
false, which causes program execution to terminate when the event handler exits. Changing its property to true specifies that the application should continue to execute. false, you can ensure that your application always exits if the user presses Ctrl+C. By setting it to true, you can ensure that pressing Ctrl+C will not terminate the application.