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 auto | auto_flush_out () -> bool |
| 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 auto | auto_flush_out (bool value) -> void |
| 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 auto | background_color () -> console_color |
| Gets the background color of the console. | |
| static auto | background_color (console_color color) -> void |
| Sets the background color of the console. | |
| static auto | buffer_height () -> int32 |
| Gets the height of the buffer area. | |
| static auto | buffer_height (int32 height) -> void |
| Sets or sets the height of the buffer area. | |
| static auto | buffer_width () -> int32 |
| Gets the width of the buffer area. | |
| static auto | buffer_width (int32 width) -> void |
| Sets the width of the buffer area. | |
| static auto | caps_lock () -> bool |
| Gets a value indicating whether the CAPS LOCK keyboard toggle is turned on or turned off. | |
| static auto | cursor_left () -> int32 |
| Gets the column position of the cursor within the buffer area. | |
| static auto | cursor_left (int32 left) -> void |
| Sets the column position of the cursor within the buffer area. | |
| static auto | cursor_size () -> int32 |
| Gets or sets the height of the cursor within a character cell. | |
| static auto | cursor_size (int32 size) -> void |
| Sets the height of the cursor within a character cell. | |
| static auto | cursor_top () -> int32 |
| Gets the row position of the cursor within the buffer area. | |
| static auto | cursor_top (int32 top) -> void |
| Sets the row position of the cursor within the buffer area. | |
| static auto | cursor_visible () -> bool |
| Gets a value indicating whether the cursor is visible. | |
| static auto | cursor_visible (bool visible) -> void |
| Sets a value indicating whether the cursor is visible. | |
| static auto | foreground_color () -> console_color |
| Gets the foreground color of the console. | |
| static auto | foreground_color (console_color color) -> bool |
| Sets the foreground color of the console. | |
| static auto | input_code_page () -> int32 |
| Gets the code page the console uses to read input. | |
| static auto | input_code_page (int32 code_page) -> void |
| Sets the code page the console uses to read input. | |
| static auto | is_error_redirected () -> bool |
| Gets a value that indicates whether the error output stream has been redirected from the standard error stream. | |
| static auto | is_input_redirected () -> bool |
| Gets a value that indicates whether the input stream has been redirected from the standard input stream. | |
| static auto | is_output_redirected () -> bool |
| Gets a value that indicates whether the output stream has been redirected from the standard output stream. | |
| static auto | key_available () -> bool |
| Gets a value indicating whether a key press is available in the input stream. | |
| static auto | largest_window_height () -> int32 |
| Gets the largest possible number of console window rows, based on the current font and screen resolution. | |
| static auto | largest_window_width () -> int32 |
| Gets the largest possible number of console window columns, based on the current font and screen resolution. | |
| static auto | number_lock () -> bool |
| Gets a value indicating whether the NUM LOCK keyboard toggle is turned on or turned off. | |
| static auto | output_code_page () -> int32 |
| Gets the code page the console uses to write output. | |
| static auto | output_code_page (int32 code_page) -> void |
| Sets the code page the console uses to write output. | |
| static auto | title () -> xtd::string |
| Gets the title to display in the console title bar. | |
| static auto | title (const xtd::string &title) -> void |
| Sets the title to display in the console title bar. | |
| static auto | treat_control_c_as_input () -> bool |
| 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 auto | treat_control_c_as_input (bool treat_control_c_as_input) -> void |
| 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 auto | window_height () -> int32 |
| Gets the height of the console window area. | |
| static auto | window_height (int32 height) -> void |
| Sets the height of the console window area. | |
| static auto | window_left () -> int32 |
| Gets the left of the console window area. | |
| static auto | window_left (int32 left) -> void |
| Sets the left of the console window area. | |
| static auto | window_top () -> int32 |
| Gets the top of the console window area. | |
| static auto | window_top (int32 top) -> void |
| Sets the top of the console window area. | |
| static auto | window_width () -> int32 |
| Gets the width of the console window area. | |
| static auto | window_width (int32 width) -> void |
| Sets the width of the console window area. | |
Public Static Methods | |
| static auto | beep () -> void |
| Plays the sound of a beep through the console speaker. | |
| static auto | beep (uint32 frequency, uint32 duration) -> void |
| Plays the sound of a beep of a specified frequency and duration through the console speaker. | |
| static auto | clear () -> void |
| Clears the console buffer and corresponding console window of display information. | |
| static auto | get_cursor_position () -> xtd::collections::generic::key_value_pair< int32, int32 > |
| Gets the position of the cursor. | |
| static auto | open_standard_error () -> std::ostream |
| Acquires the standard error stream. | |
| static auto | open_standard_input () -> std::istream |
| Acquires the standard input stream. | |
| static auto | open_standard_output () -> std::ostream |
| Acquires the standard output stream. | |
| static auto | read () -> int32 |
| Reads the next character from the standard input stream. | |
| static auto | read_key () -> console_key_info |
| Obtains the next character or function key pressed by the user. The pressed key is displayed in the console window. | |
| static auto | read_key (bool intercept) -> console_key_info |
| Obtains the next character or function key pressed by the user. The pressed key is optionally displayed in the console window. | |
| static auto | read_key (const string &text) -> console_key_info |
| Obtains the next character or function key pressed by the user. The pressed key is displayed in the console window with specified invit text. | |
| static auto | read_key (const string &text, bool intercept) -> console_key_info |
| Obtains the next character or function key pressed by the user. The pressed key is optionally displayed in the console window with specified invit text. | |
| static auto | read_line () -> xtd::string |
| Reads the next line of characters from the standard input stream. | |
| static auto | read_line (bool intercept) -> xtd::string |
| Reads the next line of characters from the standard input stream. | |
| static auto | read_line (const string &text) -> xtd::string |
| Reads the next line of characters from the standard input stream with specified invit text. | |
| static auto | read_line (const string &text, bool intercept) -> xtd::string |
| Reads the next line of characters from the standard input stream with specified invit text. | |
| template<typename string_t> | |
| static auto | read_line (string_t text) -> xtd::string |
| template<typename string_t> | |
| static auto | read_line (string_t text, bool intercept) -> xtd::string |
| static auto | reset_color () -> bool |
| Sets the foreground and background console colors to their defaults. | |
| static auto | reset_terminal_mode () -> void |
| Resets terminale mode to default. | |
| static auto | set_cursor_position (int32 left, int32 top) -> void |
| Sets the position of the cursor. | |
| static auto | set_error (const std::ostream &os) -> void |
| Sets the error property to the specified std::ostream object. | |
| static auto | set_in (const std::istream &is) -> void |
| Sets the int property to the specified std::istream object. | |
| static auto | set_out (const std::ostream &os) -> void |
| Sets the out property to the specified std::ostream object. | |
| static auto | set_window_position (int32 left, int32 top) -> void |
| Sets the position of the console window relative to the screen buffer. | |
| static auto | set_window_size (int32 width, int32 height) -> void |
| Sets the height and width of the console window to the specified values. | |
| template<typename arg_t> | |
| static auto | write (arg_t &&value) -> void |
| Writes the text representation of the specified value to the standard output stream. | |
| template<typename ... args_t> | |
| static auto | write (const xtd::string &fmt, args_t &&... values) -> void |
| Writes the text representation of the specified list of values to the standard output stream using the specified format information. | |
| template<typename arg_t> | |
| static auto | write (const xtd::globalization::culture_info &culture, arg_t &&value) -> void |
| Writes the text representation of the specified value to the standard output stream. | |
| template<typename ... args_t> | |
| static auto | write (const xtd::globalization::culture_info &culture, const xtd::string &fmt, args_t &&... values) -> void |
| Writes the text representation of the specified list of values to the standard output stream using the specified format information. | |
| static auto | write_line () -> void |
| Writes the current line terminator to the standard output stream using the specified format information. | |
| template<typename arg_t> | |
| static auto | write_line (arg_t &&value) -> void |
| Writes the text representation of the specified value, followed by the current line terminator, to the standard output stream. | |
| template<typename ... args_t> | |
| static auto | write_line (const xtd::string &fmt, args_t &&... values) -> void |
| 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. | |
| template<typename arg_t> | |
| static auto | write_line (const xtd::globalization::culture_info &culture, arg_t &&value) -> void |
| Writes the text representation of the specified value, followed by the current line terminator, to the standard output stream. | |
| template<typename ... args_t> | |
| static auto | write_line (const xtd::globalization::culture_info &culture, const xtd::string &fmt, args_t &&... values) -> void |
| 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. | |
|
staticnodiscard |
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 |
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. |
|
staticnodiscard |
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. |
Gets the height of the buffer area.
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. |
Gets the width of the buffer area.
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. |
|
staticnodiscard |
Gets a value indicating whether the CAPS LOCK keyboard toggle is turned on or turned off.
Gets the column position of the cursor within the buffer area.
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. |
Gets or sets the height of the cursor within a character cell.
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. |
Gets the row position of the cursor within the buffer area.
Sets the row position of the cursor within the buffer area.
| top | The current position, in rows, 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_height. |
|
staticnodiscard |
Gets a value indicating whether the cursor is visible.
|
static |
Sets a value indicating whether the cursor is visible.
| visible | true if the cursor is visible; otherwise, false. |
|
staticnodiscard |
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. |
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) |
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) |
|
staticnodiscard |
Gets a value that indicates whether the error output stream has been redirected from the standard error stream.
|
staticnodiscard |
Gets a value that indicates whether the input stream has been redirected from the standard input stream.
|
staticnodiscard |
Gets a value that indicates whether the output stream has been redirected from the standard output stream.
|
staticnodiscard |
Gets a value indicating whether a key press is available in the input stream.
Gets the largest possible number of console window rows, based on the current font and screen resolution.
Gets the largest possible number of console window columns, based on the current font and screen resolution.
|
staticnodiscard |
Gets a value indicating whether the NUM LOCK keyboard toggle is turned on or turned off.
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) |
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) |
|
staticnodiscard |
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. |
|
staticnodiscard |
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 |
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. |
Gets the height of the console window area.
Sets the height of the console window area.
| height | The height of the console window measured in rows. |
Gets the left of the console window area.
Sets the left of the console window area.
| left | The left of the console window measured in columns. |
Gets the top of the console window area.
Sets the top of the console window area.
| top | The top of the console window measured in rows. |
Gets the width of the console window area.
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.
|
staticnodiscard |
Gets the position of the cursor.
|
staticnodiscard |
Acquires the standard error stream.
|
staticnodiscard |
Acquires the standard input stream.
|
staticnodiscard |
Acquires the standard output stream.
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 |
Obtains the next character or function key pressed by the user. The pressed key is displayed in the console window with specified invit text.
| text | The invit text to print before read line. |
|
static |
Obtains the next character or function key pressed by the user. The pressed key is optionally displayed in the console window with specified invit text.
| text | The invit text to print before read line. |
| 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 |
Reads the next line of characters from the standard input stream with specified invit text.
| text | The invit text to print before read line. |
|
static |
Reads the next line of characters from the standard input stream with specified invit text.
| text | The invit text to print before read line. |
| 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.
|
static |
Resets terminale mode to default.
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, |
|
inlinestatic |
Writes the text representation of the specified value to the standard output stream.
| arg_t | The type of the value to write. |
| culture | The xtd::globalization::culture_info used to print value. |
| 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. |
| culture | The xtd::globalization::culture_info used to print value. |
| 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, |
|
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. |
| culture | The xtd::globalization::culture_info used to print value. |
| 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. |
| culture | The xtd::globalization::culture_info used to print value. |
| 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).