Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 06-02-2010, 04:47 PM   #1
LQ Newbie
Registered: Apr 2007
Posts: 12

Rep: Reputation: 0
Talking Reenable CTRL+C in rawmode

changed terminal into raw mode

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?


Last edited by legendbb; 06-03-2010 at 11:50 AM. Reason: solved
Old 06-02-2010, 06:08 PM   #2
harry edwards
Registered: Nov 2007
Location: Lincolnshire, UK
Distribution: CentOS, Fedora, and Suse
Posts: 365

Rep: Reputation: 48
What about
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.
Old 06-02-2010, 07:56 PM   #3
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905
If you are looking for a termios interface in your application:
    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.
1 members found this post helpful.
Old 06-03-2010, 11:49 AM   #4
LQ Newbie
Registered: Apr 2007
Posts: 12

Original Poster
Rep: Reputation: 0
Thanks to theNbomr,
Worked perfectly!


mode, raw

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
what are the system calls called during executing ctrl+c and ctrl+v commands ramyayella Linux - General 5 02-18-2010 06:46 PM
Recognizing ctrl+c,ctrl+l,ctrl+d in C programs leonardo6023 Programming 1 08-19-2009 10:23 AM
synaptics-0.15.0 - Howto reenable Tap-to-Click after upgrade ppr:kut Slackware 8 09-17-2008 11:10 AM
KDE 3.5.9 - Konqueror - keyboard shortcuts ctrl+, and ctrl+. sometimes stop working bhy Linux - Desktop 1 07-26-2008 12:48 PM
Any way to create bash short cuts (like CTRL+l for clear and Ctrl+D for exit) supersubu123 Linux - General 5 05-30-2007 04:02 AM

All times are GMT -5. The time now is 06:53 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration