xtd 0.2.0
console_info.cpp

Shows how to use xtd::console class.

#include <xtd/console>
using namespace xtd;
auto main() -> int {
console::write_line("background_color = {}", console::background_color());
console::write_line("foreground_color = {}", console::foreground_color());
console::write_line("buffer_height = {}", console::buffer_height());
console::write_line("buffer_width = {}", console::buffer_width());
console::write_line("cursor_left = {}", console::cursor_left());
console::write_line("cursor_size = {}", console::cursor_size());
console::write_line("cursor_visible = {}", console::cursor_visible());
console::write_line("foreground_color = {}", console::foreground_color());
console::write_line("is_rrror_redirected = {}", console::is_error_redirected());
console::write_line("is_input_redirected = {}", console::is_input_redirected());
console::write_line("is_output_redirected = {}", console::is_output_redirected());
console::write_line("key_available = {}", console::key_available());
console::write_line("largest_window_height = {}", console::largest_window_height());
console::write_line("largest_window_width = {}", console::largest_window_width());
console::write_line("treat_control_c_as_input = {}", console::treat_control_c_as_input());
console::write_line("window_height = {}", console::window_height());
console::write_line("window_left = {}", console::window_left());
console::write_line("window_width = {}", console::window_width());
}
// This code can produce the following output :
//
// background_color = black
// foreground_color = white
// buffer_height = 24
// buffer_width = 80
// caps_lock = false
// cursor_left = 0
// cursor_size = 100
// cursor_top = 0
// cursor_visible = true
// foreground_color = white
// is_rrror_redirected = false
// is_input_redirected = false
// is_output_redirected = false
// key_available = false
// largest_window_height = 1000
// largest_window_width = 1000
// title =
// treat_control_c_as_input = false
// window_height = 24
// window_left = 0
// window_top = 0
// window_width = 80
static bool is_input_redirected()
Gets a value that indicates whether the input stream has been redirected from the standard input stre...
static int32 buffer_height()
Gets the height 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 window_height()
Gets the height of the console window area.
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...
static bool is_error_redirected()
Gets a value that indicates whether the error output stream has been redirected from the standard err...
static console_color background_color()
Gets the background color of the console.
static console_color foreground_color()
Gets the foreground color of the console.
static int32 cursor_top()
Gets the row 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 int32 largest_window_height()
Gets the largest possible number of console window rows, based on the current font and screen resolut...
static int32 largest_window_width()
Gets the largest possible number of console window columns, based on the current font and screen reso...
static bool is_output_redirected()
Gets a value that indicates whether the output stream has been redirected from the standard output st...
static xtd::string title()
Gets the title to display in the console title bar.
static int32 cursor_left()
Gets the column position of the cursor within the buffer area.
static bool key_available()
Gets a value indicating whether a key press is available in the input stream.
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
static int32 window_width()
Gets the width of the console window area.
static bool cursor_visible()
Gets a value indicating whether the cursor is visible.
static int32 window_left()
Gets the left of the console window area.
static int32 buffer_width()
Gets the width of the buffer area.
static int32 window_top()
Gets the top of the console window area.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8