Thread: Get Ctrl+Shift

  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    1

    Get Ctrl+Shift

    Hello friends,,,
    how to detection keyboard even but with double pressing like Ctrl+c or other ...???

  2. #2
    Technical Lead QuantumPete's Avatar
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    894
    Quote Originally Posted by 406 View Post
    Hello friends,,,
    how to detection keyboard even but with double pressing like Ctrl+c or other ...???
    You can detect ctrl+c by catching SIGTERM.

    QuantumPete
    "No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
    "Have you tried turning it off and on again?" - The IT Crowd

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Well that depends on your platform.
    Ctrl-C in windows typically copies things to the clipboard.
    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. #4
    Technical Lead QuantumPete's Avatar
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    894
    Quote Originally Posted by Salem View Post
    Well that depends on your platform.
    Ctrl-C in windows typically copies things to the clipboard.
    Yeah, that took some time to get used to when I switched to UNIX... Same with ctrl+s freezing xterms instead of saving in vim.

    QuantumPete
    "No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
    "Have you tried turning it off and on again?" - The IT Crowd

  5. #5
    Registered User
    Join Date
    Jul 2007
    Posts
    131
    Code:
    #include <stdio.h>
    
    int
    main(void)
    {
            int c;
    
            c = getchar();
            if (c == '\a')
                printf("Caught ^G (0x07)\n");
    
            return 0;
    }
    Simple as that.

  6. #6
    Technical Lead QuantumPete's Avatar
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    894
    That's ctrl+g not ctrl+c
    You'll need something more elaborate to catch signals (if indeed the OP is working on UNIX).

    QuantumPete
    "No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
    "Have you tried turning it off and on again?" - The IT Crowd

  7. #7
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,059
    which platform are you working on, Windows or Unix since the response to pressing Ctrl-C is dependent on that.

  8. #8
    Registered User
    Join Date
    Jul 2007
    Posts
    131
    Quote Originally Posted by QuantumPete View Post
    That's ctrl+g not ctrl+c
    You'll need something more elaborate to catch signals (if indeed the OP is working on UNIX).

    QuantumPete
    He didn't say he wants to catch only ^C, he said he wants to catch it and others like that. I answered how to catch easily ones which don't have any special meaning provided by operating system, terminal or some other.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. still problems with ceasar shift
    By trevordunstan in forum C Programming
    Replies: 2
    Last Post: 09-14-2008, 01:49 AM
  2. Ceasar Shift program
    By trevordunstan in forum C Programming
    Replies: 11
    Last Post: 09-11-2008, 09:40 PM
  3. Caeser Cipher
    By L_U_K_E in forum C++ Programming
    Replies: 35
    Last Post: 06-30-2006, 07:15 AM
  4. Simulating Shift Key
    By PrimeTime00 in forum Windows Programming
    Replies: 7
    Last Post: 10-15-2004, 05:53 AM
  5. how to capture CTRL, SHIFT and ALT ?
    By goldenrock in forum C Programming
    Replies: 3
    Last Post: 11-06-2003, 01:20 AM