1

I'm trying to read from the standard input and I'd like to avoid displaying expressions such as ^C or ^D when pressing ctrl+C .... I'm only allowed to use tcsetattr and tcgetattr functions.

int main() {
    while(1) {};
}
Jabberwocky
  • 48,281
  • 17
  • 65
  • 115
  • 1
    Does this answer your question? [Catch Ctrl-C in C](https://stackoverflow.com/questions/4217037/catch-ctrl-c-in-c) – Robert Harvey Feb 10 '23 at 11:21
  • 2
    The way control characters are echoed by the terminal is controlled by the `ECHOCTL` flag in the `c_lflag` member of the `struct termios` sent to the the terminal by `tcsetattr()`. If the flag is not set, control characters will be echoed as raw characters. This flag is an extension to the POSIX / Open Group specification. See your system's "termios" man page for details. – Ian Abbott Feb 10 '23 at 12:44

0 Answers0