Shows how to use xtd::console::cursor_visible property.
#include <xtd/console>
auto main() -> int {
auto m1 = "\nThe cursor is {0}.\nType any text then press Enter. "
"Type '+' in the first column to show \n"
"the cursor, '-' to hide the cursor, "
"or lowercase 'x' to quit:"_s;
auto s = string::empty_string;
auto save_cursor_visibile = console::cursor_visible();
auto save_cursor_size = console::cursor_size();
console::cursor_visible(true);
console::cursor_size(100);
while (true) {
console::write_line(m1, ((console::cursor_visible() == true) ? "VISIBLE" : "HIDDEN"));
s = console::read_line();
if (string::is_empty(s) == false) {
if (s[0] == '+')
console::cursor_visible(true);
else if (s[0] == '-')
console::cursor_visible(false);
else if (s[0] == 'x')
break;
}
}
console::cursor_visible(save_cursor_visibile);
console::cursor_size(save_cursor_size);
}
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10