What is raw() at ncurses. h

Asked

Viewed 220 times

4

Recently I’m trying to learn more about ncurses library and came across some codes that use

raw();

When I took it out to test what was happening, nothing changed, the code compiled and worked perfectly. So why does raw() exist ? What is it for? What is its function ?

  • https://linux.die.net/man/3/raw

  • I had already seen this site, and I didn’t understand anything. Someone can explain me in a simpler way ?

1 answer

4


The functions raw() and noraw() turns on and off the raw mode terminal. That is, when the terminal is in raw mode (we can translate to "raw mode", or "no processing mode"), typed characters are passed to the program running on the terminal immediately and directly. Consequently, the interrupt, close, suspension and flow control characters are all passed, not interpreted by the terminal and generate some signal.

For example, if we open a program that calls the function raw() and puts the terminal in raw mode and press CTRL+C (meaning the control character ^C, that generates a signal SIGINT pro program running on the terminal), we would have no response from the terminal. Instead of generating the interrupt signal, the terminal would pass the control character ^C direct to the program, which in turn will be able to read it. Without the raw mode, the terminal would interpret the character ^C and generate an interruption signal for the program, which would practically end the program.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.