[comp.lang.c] Checking for Keyboard Input...

eap@bucsb.bu.edu.UUCP (Eric Pearce) (07/11/87)

I would like to write a routine that performs a repeated sequence of statements
(i.e. a loop) that would check for input from the keyboard and do something
according to what was typed in.  Also, it would be able to continue doing the
loop regardless of whether or not anything was typed in from the keyboard.

like this:

    Begin Loop
      check for keyboard input
      if a key was pressed 
                     case
                         1) do something
                         2) do something else
                         ...
                     esac 
      fi
      do some more stuff
    End Loop

I used to be able to do this easily on my Apple ][.  You could check a memory
location to see if a key had been pressed and which one it was, without having
the program wait for user input.   (good for games)

Is there a way to do this in C?  Or maybe a different approach to the problem?
(this is intended for a program on a mainframe)

                                              ANY ideas welcome!

                                                           -Eric

-- 
*******************************************************************************
* UUCP   : ..!harvard!bu-cs!bucsb!eap |-+-+ +-+-+-+-+-+-+-+\ /-+-+-+-+-+-+-+-+*
* ARPANET: eap@bucsb.bu.edu           |    > :   :   :    - @ -  |       g    *
* CSNET  : eap%bucsb@bu-cs            |-+-+-+-+-+-+-+-+-+-+/ \ +-+-+ +-+-+ +-+*
* BITNET : cscc8vc@bostonu            | |  Blasted by ZAXXON   |  ;  |        *
*******************************************************************************