consolekeyavailable

September 14, 2025 ยท View on GitHub

Shows how to use xtd::console::key_available and xtd::console::read_key methods.

Sources

Build and run

Open "Command Prompt" or "Terminal". Navigate to the folder that contains the project and type the following:

xtdc run

Output if user stroke 'h', 'e', pagge_up, down_arrow, and 'x' keys

Press a key to display; press the 'x' key to quit.
You pressed the 'h' key.

Press a key to display; press the 'x' key to quit.
You pressed the 'e' key.

Press a key to display; press the 'x' key to quit.
You pressed the 'page_up' key.

Press a key to display; press the 'x' key to quit.
You pressed the 'down_arrow' key.

Press a key to display; press the 'x' key to quit.
You pressed the 'x' key.