LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


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

Rep: Reputation: 0
Talking 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,

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

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

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.
 
1 members found this post helpful.
Old 06-03-2010, 10:49 AM   #4
legendbb
LQ Newbie
 
Registered: Apr 2007
Posts: 12

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


Reply

Tags
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 05:46 PM
Recognizing ctrl+c,ctrl+l,ctrl+d in C programs leonardo6023 Programming 1 08-19-2009 09:23 AM
synaptics-0.15.0 - Howto reenable Tap-to-Click after upgrade ppr:kut Slackware 8 09-17-2008 10:10 AM
KDE 3.5.9 - Konqueror - keyboard shortcuts ctrl+, and ctrl+. sometimes stop working bhy Linux - Desktop 1 07-26-2008 11:48 AM
Any way to create bash short cuts (like CTRL+l for clear and Ctrl+D for exit) supersubu123 Linux - General 5 05-30-2007 03:02 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:03 AM.

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