LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Reenable CTRL+C in rawmode (https://www.linuxquestions.org/questions/programming-9/reenable-ctrl-c-in-rawmode-811781/)

legendbb 06-02-2010 03:47 PM

Reenable CTRL+C in rawmode
 
changed terminal into raw mode
cfmakeraw(&termios);

After that terminal no more captures CTRL+C

Is there a way to enable CTRL+C (to terminate the program) while still have RAW mode?

Thanks,

harry edwards 06-02-2010 05:08 PM

What about
Code:

stty intr "^C"
? This is how I have controlled the assignment of Ctrl+C in the past; however, I am unsure whether this applies to raw mode.

theNbomr 06-02-2010 06:56 PM

If you are looking for a termios interface in your application:
Code:

    tcgetattr(fd, &options);
    options.c_cc[VINTR] = 3;                  /* Ctrl-C */
    options.c_lflag |= ISIG;
    tcsetattr(fd, TCSANOW, &options);

this should work (fd is the serial port file descriptor).

--- rod.

legendbb 06-03-2010 10:49 AM

Thanks to theNbomr,
Worked perfectly!


All times are GMT -5. The time now is 09:39 AM.