mirror of
https://github.com/reactos/reactos.git
synced 2025-05-29 22:18:13 +00:00
Added some files
svn path=/trunk/; revision=254
This commit is contained in:
parent
ddbc094b81
commit
95a2cd9225
4 changed files with 58 additions and 2 deletions
17
reactos/lib/crtdll/conio/cprintf.c
Normal file
17
reactos/lib/crtdll/conio/cprintf.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include <stdio.h>
|
||||
#include <conio.h>
|
||||
|
||||
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;
|
||||
}
|
26
reactos/lib/crtdll/conio/cscanf.c
Normal file
26
reactos/lib/crtdll/conio/cscanf.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include <conio.h>
|
||||
|
||||
|
||||
/*
|
||||
* 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 ** )));
|
||||
}
|
||||
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
13
reactos/lib/crtdll/conio/kbhit.c
Normal file
13
reactos/lib/crtdll/conio/kbhit.c
Normal file
|
@ -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;
|
||||
}
|
Loading…
Reference in a new issue