[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
#include <conio.h>
int ungetch( int c );
Description:
The ungetch function pushes the character specified by c back onto the
input stream for the console. This character will be returned by the
next read from the console (with getch or getche functions) and will
be detected by the function kbhit. Only the last character returned in
this way is remembered.
The ungetch function clears the end-of-file indicator, unless the value
of c is EOF.
Returns:
The ungetch function returns the character pushed back.
Example:
#include <stdio.h>
#include <ctype.h>
#include <conio.h>
void main()
{
int c;
long value;
value = 0;
c = getche();
while( isdigit( c ) ) {
value = value*10 + c - '0';
c = getche();
}
ungetch( c );
printf( "Value=%ld\n", value );
}
Classification:
WATCOM
Systems:
All, Netware
See Also:
getch, getche, kbhit, putch
See Also: getch getche
Online resources provided by: http://www.ClipX.Net --- NG 2 HTML conversion by Dave Pearson