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.