예제 #1
0
// Pushes back ("ungets") one character to be read next by _getwch() or
// _getwche().  On success, returns the character that was pushed back; on
// failure, returns EOF.
extern "C" int __cdecl _ungetch(int const c)
{
    __acrt_lock(__acrt_conio_lock);
    int result = 0;
    __try
    {
        result = _ungetch_nolock(c);
    }
    __finally
    {
        __acrt_unlock(__acrt_conio_lock);
    }
    return result;
}
예제 #2
0
파일: getch.c 프로젝트: flychen50/clib
int __cdecl _ungetch (
        int c
        )
{
        int retval;

        _mlock(_CONIO_LOCK);            /* lock the console */
        __TRY
            retval = _ungetch_nolock(c);        /* pushback character */
        __FINALLY
            _munlock(_CONIO_LOCK);          /* unlock the console */
        __END_TRY_FINALLY

        return retval;
}