2

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.

n. 1.8e9-where's-my-share m.
  • 102,958
  • 14
  • 123
  • 225
gartenriese
  • 3,759
  • 3
  • 33
  • 58

1 Answers1

1

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.

Community
  • 1
  • 1
gartenriese
  • 3,759
  • 3
  • 33
  • 58