#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    3
    Rep Power
    0

    Ignore "^c" from printing in prompt


    I'm handling the sigint signal and i can't find the function that ignores the ^C from being printed. Anyone that could give me a hand? thanks
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,367
    Rep Power
    1870
    I suppose we first need to guess which OS and compiler you're using.

    Or we could wait until you tell us.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    3
    Rep Power
    0
    unix and gcc
  6. #4
  7. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,367
    Rep Power
    1870
    http://linux.die.net/man/3/termios
    Perhaps mess around with the IGNBRK, ISIG (possibly some others), or just make the whole input 'raw'.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    3
    Rep Power
    0
    Originally Posted by salem
    Perhaps mess around with the IGNBRK, ISIG (possibly some others), or just make the whole input 'raw'.
    Wouldn't that change the terminal definitions? i just want to ignore the printing of ^c when pressing ctrl+c and still send the signal. I'm able to handle the signal already, I just don't know how to not print ^c when pressing ctrl+c
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    May 2004
    Posts
    3,417
    Rep Power
    886
    On some terminals you can send a couple of backspaces to the terminal in your handler to rub-out the ^C sequence. Otherwise you need to use a non-echoing terminal mode that requires you to write code to echo whatever you do want to show up on the screen.
    I no longer wish to be associated with this site.

IMN logo majestic logo threadwatch logo seochat tools logo