Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - inkey() read a key from the keyboard and return key code http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 inkey()             Read a key from the keyboard and return key code
------------------------------------------------------------------------------
 Declaration
   io.hdr

 Syntax
   func uint inkey extern

 Arguments
   None.

 Return
   The code of the first available keypress.

 Description
   The inkey() function reads a key from the keyboard and returns its
   numeric value. If a key is not available, then zero is returned. If a key
   is available, it is removed from the keyboard buffer and returned to the
   caller.

 Example
   #define EXAMPLE_IO
   #include example.hdr

   proc Test_inkey
   // Display a message until a key is pressed.
   vardef
      uint uKey
   enddef
   ? "I'm just waiting on a key..."
   do while .t.                          // loop
      uKey := inkey()                    // get pending key press
      if uKey != 0                       // if key press received
         exit                            // exit loop
      endif
   enddo
   ? "Just got a key. It was", chr( uKey ), istr( uKey )
   endproc

   proc main
   Test_inkey()
   endproc

See Also: getkey() iskey()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson