diff --git a/reactos/lib/crtdll/conio/cprintf.c b/reactos/lib/crtdll/conio/cprintf.c new file mode 100644 index 00000000000..72411163751 --- /dev/null +++ b/reactos/lib/crtdll/conio/cprintf.c @@ -0,0 +1,17 @@ +#include +#include + +int +cprintf(const char *fmt, ...) +{ + int cnt; + char buf[ 2048 ]; /* this is buggy, because buffer might be too small. */ + va_list ap; + + va_start(ap, fmt); + cnt = vsprintf(buf, fmt, ap); + va_end(ap); + + cputs(buf); + return cnt; +} diff --git a/reactos/lib/crtdll/conio/cscanf.c b/reactos/lib/crtdll/conio/cscanf.c new file mode 100644 index 00000000000..3fa931c035a --- /dev/null +++ b/reactos/lib/crtdll/conio/cscanf.c @@ -0,0 +1,26 @@ +#include + + +/* + * The next two functions are needed by cscanf + */ +static int +_scan_getche(FILE *fp) +{ + return(getche()); +} + +static int +_scan_ungetch(int c, FILE *fp) +{ + return(ungetch(c)); +} + +int +_cscanf(const char *fmt, ...) +{ + return(_doscan_low(NULL, _scan_getche, _scan_ungetch, + fmt, (void **) unconst( ((&fmt)+1), char ** ))); +} + + diff --git a/reactos/lib/crtdll/conio/getch.c b/reactos/lib/crtdll/conio/getch.c index 5fc66ed507a..e83c885e157 100644 --- a/reactos/lib/crtdll/conio/getch.c +++ b/reactos/lib/crtdll/conio/getch.c @@ -32,11 +32,11 @@ _getch(void) } else { - ReadConsoleA(filehnd(stdin->_file), &c,1,&NumberOfCharsRead ,NULL); + ReadConsoleA(_get_osfhandle(stdin->_file), &c,1,&NumberOfCharsRead ,NULL); } if ( c == 10 ) c = 13; putchar(c); return c; -} \ No newline at end of file +} diff --git a/reactos/lib/crtdll/conio/kbhit.c b/reactos/lib/crtdll/conio/kbhit.c new file mode 100644 index 00000000000..50b185f7d36 --- /dev/null +++ b/reactos/lib/crtdll/conio/kbhit.c @@ -0,0 +1,13 @@ +int +_kbhit(void) +{ + INPUT_RECORD InputRecord; + DWORD NumberRead; + if (char_avail) + return(1); + else { + PeekConsoleInput(stdin->file,&InputRecord,1,&NumberRead); + return NumberRead; + } + return 0; +}