Shows how to use xtd::console::read_key and xtd::console::key_available methods.
#include <xtd/as>
#include <xtd/console>
auto main() -> int {
console::write_line("Signal {0} intercepted !", e.special_key());
e.cancel(true);
};
while (true) {
if (console::key_available()) {
auto key_info = console::read_key(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());
if (key_info.key() == console_key::escape) break;
}
}
}
Provides data for the console::cancel_key_press event. This class cannot be inherited.
Definition console_cancel_event_args.hpp:22
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10