Reputation: 4366
When I press enter while my terminal program runs, a new line is added. How can I disable this? I don't want to use ncurses. I am on Ubuntu.
Upvotes: 2
Views: 688
Reputation: 4366
Following up n.m's hint, I found this and came up with this:
static struct termios t;
tcgetattr( STDIN_FILENO, &t);
t.c_lflag &= ~ECHO;
tcsetattr( STDIN_FILENO, TCSANOW, &t);
This seems to block all input to the terminal.
Upvotes: 1