Shows how to use xtd::console::read_key and xtd::console::key_available methods.
#include <xtd/as>
#include <xtd/console>
auto main() -> int {
};
while (true) {
console::write_line(
"Key = {} ({}), Char = '{}' ({}), Modifiers = {}", key_info.key(),
as<int>(key_info.key()), key_info.key_char(),
as<int>(key_info.key_char()), key_info.modifiers());
}
}
}
Provides data for the console::cancel_key_press event. This class cannot be inherited.
Definition console_cancel_event_args.hpp:22
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 ...
Definition console.hpp:335
static console_key_info read_key()
Obtains the next character or function key pressed by the user. The pressed key is displayed in the c...
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...
type_t as(any_object &o)
Casts a type into another type.
Definition __as_any_object.hpp:59
@ escape
The ESC (ESCAPE) key.
Definition console_key.hpp:34
@ e
The E key.
Definition console_key.hpp:96
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8