Added some files

svn path=/trunk/; revision=254
This commit is contained in:
Boudewijn Dekker 1999-02-21 08:39:36 +00:00
parent ddbc094b81
commit 95a2cd9225
4 changed files with 58 additions and 2 deletions

View 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;
}

View 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 ** )));
}

View file

@ -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;
}
}

View 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;
}