What is raw () in ncurses.h?

4

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

raw();

When I took it to test what happened, it did not change anything, the code compiled and worked perfectly. So why does raw () exist? What is it for? What is your role?

    
asked by anonymous 10.05.2018 / 23:19

1 answer

4

The raw() and noraw() functions enables and disables the raw mode of the terminal. That is, when the terminal is in raw mode (we can translate it to "raw mode" or "unprocessed mode"), typed characters are passed to the program running on the terminal directly and directly. Consequently, the characters for interrupt, shutdown, suspend, and flow control are all passed, not being interpreted by the terminal and generating some signal.

For example, if we open a program that calls the function raw() and puts the terminal in raw mode and press (meaning the control character ^C , which generates a SIGINT sign for the program running on the terminal), we would not have any 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 raw mode , the terminal would interpret the character ^C and would generate an interrupt signal for the program, which would almost terminate the program.

    
11.05.2018 / 19:20