ungetch

Pushes a specified character back onto the input stream for the current screen

Local Servers:nonblocking
Remote Servers:N/A
Classification:Other
Service:Device I/O

Syntax

  #include <nwconio.h> 
    
  int ungetch  (  
     int   charToPushBack);
  

Parameters

charToPushBack

(IN) Specifies the character to be pushed back to the console.

Return Values

ungetch returns the character pushed back to the console if successful.

Remarks

ungetch pushes the character specified by the charToPushBack parameter onto the input stream for the current screen. This character is returned by the next read from the console (by the getch or getche functions) and is detected by the kbhit function. Only the last character returned in this way is remembered.

ungetch clears the end-of-file indicator, unless the value of the charToPushBack parameter is EOF.

ungetch also pushes extended keystrokes. The following table lists extended keys and their " ungetch " values:

Key

Value

F1

0x3B00

F2

0x3C00

F3

0x3D00

F4

0x3E00

F5

0x3F00

F6

0x4000

F7

0x4100

F8

0x4200

F9

0x4300

F10

0x4400

HOME

0x4700

UP

0x4800

PGUP

0x4900

LEFT

0x4B00

RIGHT

0x4D00

END

0x4F00

DOWN

0x5000

PGDOWN

0x5100

INSERT

0x5200

DELETE

0x5300

See scrhand.c.

See Also

getch, getche