Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>inkey()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
INKEY()


Syntax:     INKEY([<expN>])

Purpose:    To read a character from the keyboard buffer.

Argument:   <expN> specifies the number of seconds INKEY() waits for
            a key press.  Specifying zero halts the program until a key
            is pressed.  The time INKEY() waits is based on the
            operating system clock and not related to the microprocessor
            speed.

            If <expN> is omitted, INKEY() does not wait for a key press.

Returns:    An integer numeric value.

            INKEY() returns a number from -39 to 386, identifying the
            ASCII code of the key pressed (the same value as returned by
            LASTKEY()).  If the keyboard buffer is empty, INKEY()
            returns zero.

            INKEY() returns values for all function, Alt-function,
            Ctrl-function, Alt-letter, and Ctrl-letter key combinations.

Usage:      INKEY() is useful for polling the keyboard or pausing
            program execution.  As an instance, you can use INKEY() to
            terminate commands with a record scope such as LIST, LABEL
            FORM, and REPORT FORM by including it in a WHILE condition
            as follows:

            Esc = 27
            REPORT FORM Report WHILE INKEY() <> Esc

Library:    CLIPPER.LIB


----------------------------------- Example --------------------------------

   The following displays the character and the code after a
   key is pressed:

   i = 0
   DO WHILE LASTKEY() <> 27
      ? "Press any key: "
      i = INKEY(0)
      ?? "Character:", CHR(i), "ASCII code:",;
         LTRIM(STR(i))
   ENDDO
   RETURN


See Also: SET KEY CHR() LASTKEY() ReadKey() Keyboard codes

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