246 INKEY$ input the character pressed Purpose This function waits for a specified time while constantly testing to see if a key has been pressed on the keyboard. If a key is pressed before the time runs out then the letter or number pressed is placed in the string variable. If no key is pressed in the given time then an empty string is returned and the program continues. Note that a key can be pressed at any time before INKEY$ is used. All keys pressed are stored in a buffer in the computer and a character is removed from the buffer by, for example, the INPUT statement.
You can clear the buffer of all characters by giving the command *FX 15,1 The number in parenthesis, after the word INKEY$ , gives the amount of time that the computer must wait before giving up. The time is given in hundredths of a second. Examples 120 letter$=INKEY$(0) 384 result$=INKEY$(100) 920 X$=INKEY$(Y) A function which waits for a key to be pressed within a specified period of time. The function returns a null string if no key is pressed in the specified time. If a key is pressed the string returned consists of the single character pressed. The argument is the maximum time in hundredths of a second. Description Syntax = INKEY$ ( ) Associated keywords GET , GET$ , INKEY