Calling the readKey function

The call to the readKey function in Listing 6 returns the next character from the keyboard buffer in ASCII format.

If the buffer is empty, it blocks and waits until a key is pressed.

As a result, the window shown in Figure 1 remains on the screen until you press a key.

Then it disappears.

In this case, the program simply ignores the value of the keystroke that is returned.