Thread: keyboard(is it possible?)

  1. #1
    Registered User
    Join Date
    Oct 2005
    Location
    Brasil
    Posts
    220

    keyboard(is it possible?)

    what should i do to make my program recognise that im hiting the ESC key of the keyboard or any other key ty

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    provide some useful information. Like compiler, operating system, etc

  3. #3
    Registered User
    Join Date
    Oct 2005
    Location
    Brasil
    Posts
    220
    windows, compiler dev-c++

  4. #4
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Which version of windows, console or windowed app?

    Don't just answer my questions, think about what might be important information and give it up. But I'd search the board for how to read function keys

  5. #5
    Disrupting the universe Mad_guy's Avatar
    Join Date
    Jun 2005
    Posts
    258
    operating systems: mac os 10.6, debian 5.0, windows 7
    editor: back to emacs because it's more awesomer!!
    version control: git

    website: http://0xff.ath.cx/~as/

  6. #6
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    test the return value of the keyboard input function for ESC key.
    Code:
    const int ESC = 27;
    int c = cin.get();
    if( c == ESC)
    {
       // do something
    }

  7. #7
    Registered User
    Join Date
    Sep 2005
    Posts
    57
    not what i had in mind for me i would do this

    Code:
    #inlcude <conio>
    ..
    int menu;
    menu=getch();
    switch (menu)
    {
               case(27);
               {
                 ...
               }
    }

  8. #8
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Kenny is on the right track. I create a example program like this for another person recently, feel free to use it and learn from it. It uses CONIO.H. There is also a way to do this similarly with WINDOWS.H
    Sent from my iPadŽ

  9. #9
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    Quote Originally Posted by kennny2004
    not what i had in mind for me i would do this
    If you wanted C code then you should have posted the question on the C board, not the C++ board.

Popular pages Recent additions subscribe to a feed