Thread: continues input

  1. #1
    Master n00b Matty_Alan's Avatar
    Join Date
    Jun 2007
    Location
    Bloody Australia Mate!
    Posts
    96

    continues input

    I want to make somthing that generates continues input weather a key is pressed or not:
    this is what iv'e got so far to try and explain what i mean...

    Code:
    For(;;)
    {
    system("cls");                                 //clears the screan ready for input
    getch();                                    //Gets Input
    
    switch                      //used to deal with what the input means
    {
    
    }
    
    }            // End Of for
    the thing with this is when it hits getch(); the system pauses and waits for input
    how do i meake it skip the input if no keys are being pressed?

    or did i just bite off more then i can chew?

    ~Matty-Alan~

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    You can't do this in plain vanilla C. You have to use non-portable methods to do this, some of which might be portable within an O/S family (ie. a Windows or a Unix/Linux manner).

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    you want a non-blocking operation. The C standard doesn't really have those. You'll have to use an OS API, which I'm guessing is more than you can chew right now. nonetheless, there are some win32 reference links in the windows programming board.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I would love some input on my BST tree.
    By StevenGarcia in forum C++ Programming
    Replies: 4
    Last Post: 01-15-2007, 01:22 AM
  2. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  3. Stupid Question
    By digdug4life in forum C++ Programming
    Replies: 22
    Last Post: 05-17-2005, 11:43 AM
  4. Help with Input Checking
    By Derek in forum C Programming
    Replies: 7
    Last Post: 06-17-2003, 03:07 AM
  5. need help with some input
    By blindleaf in forum C Programming
    Replies: 2
    Last Post: 03-16-2003, 01:50 PM