Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<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.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson