user1753491
user1753491

Reputation: 453

Don't print char when using getch() ncurses

I need to get a char with ncurses, but when I get the char, I don't want it printed to the screen. Is there a way to do this?

Upvotes: 3

Views: 2825

Answers (1)

Chrisuu
Chrisuu

Reputation: 302

Assuming you're using C, you can use noecho();.

The following is a relevant excerpt from the manual pages.

The echo and noecho routines control whether characters typed by the user are echoed by getch as they are typed. Echoing by the tty driver is always disabled, but initially getch is in echo mode, so characters typed are echoed. Authors of most interactive programs prefer to do their own echoing in a controlled area of the screen, or not to echo at all, so they disable echoing by calling noecho.

Upvotes: 3

Related Questions