Results 1 to 4 of 4

Thread: Keys in console..

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2001
    Location
    Arvika, Sweden
    Posts
    3

    Question Keys in console..

    Hi.

    Just one question.

    In a console application, are there any way it can detect keypresses? For example, if someone press the down arrow key and I want something special to happen when it is pressed, do it exist any code like:

    case keydown or something?

    Sorry for my bad english..
    "Sleep in a barrel, or sleep like a fish"

  2. #2
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    here you, just include the header file if you want the values for the special keys, like f1-f9, and control + key

    PHP Code:
    #include <stdio.h>
    #include <conio.h>


    int main(int argccharargv[])
    {
        
    int i;
        
    i=getch();
        
    printf("%d",i); //print out what key they pressed
                    
    if(i==224)
                       
    printf("you pressed the up key!\n");

    they don't have to press enter

    hope that helps
    -nabeel
    Attached Files Attached Files
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2001
    Location
    Arvika, Sweden
    Posts
    3
    Thanks, works great!
    "Sleep in a barrel, or sleep like a fish"

  4. #4
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    yups no prob
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width