ungetch.gml
来自「开放源码的编译器open watcom 1.6.0版的源代码」· GML 代码 · 共 51 行
GML
51 行
.func ungetch
#include <conio.h>
int ungetch( int c );
.ixfunc2 '&KbIo' &func
.funcend
.desc begin
The &func function pushes the character specified by
.arg c
back onto the input stream for the console.
This character will be returned by the next read from the console (with
.kw getch
or
.kw getche
functions) and will be detected by the function
.kw kbhit.
Only the last character returned in this way is remembered.
.pp
The &func function clears the end-of-file indicator, unless the value of
.arg c
is
.kw EOF.
.desc end
.return begin
The &func function returns the character pushed back.
.return end
.see begin
.im seeiocon ungetch
.see end
.exmp begin
#include <stdio.h>
#include <ctype.h>
#include <conio.h>
void main()
{
int c;
long value;
.exmp break
value = 0;
c = getche();
while( isdigit( c ) ) {
value = value*10 + c - '0';
c = getche();
}
ungetch( c );
printf( "Value=%ld\n", value );
}
.exmp end
.class WATCOM
.system
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?