ReactOS 0.4.16-dev-2104-gb84fa49
conio.h File Reference
#include <corecrt.h>
Include dependency graph for conio.h:

Go to the source code of this file.

Macros

#define cprintf   _cprintf
 
#define cscanf   _cscanf
 

Functions

_ACRTIMP char *__cdecl _cgets (char *)
 
_ACRTIMP int __cdecl _cprintf (const char *,...)
 
_ACRTIMP int __cdecl _cputs (const char *)
 
_ACRTIMP int __cdecl _cscanf (const char *,...)
 
_ACRTIMP int __cdecl _getch (void)
 
_ACRTIMP int __cdecl _getche (void)
 
_ACRTIMP int __cdecl _kbhit (void)
 
_ACRTIMP int __cdecl _putch (int)
 
_ACRTIMP int __cdecl _ungetch (int)
 
static charcgets (char *str)
 
static int cputs (const char *str)
 
static int getch (void)
 
static int getche (void)
 
static int kbhit (void)
 
static int putch (int c)
 
static int ungetch (int c)
 

Macro Definition Documentation

◆ cprintf

#define cprintf   _cprintf

Definition at line 61 of file conio.h.

◆ cscanf

#define cscanf   _cscanf

Definition at line 62 of file conio.h.

Function Documentation

◆ _cgets()

_ACRTIMP char *__cdecl _cgets ( char str)

Definition at line 392 of file console.c.

393{
394 char *buf = str + 2;
395 DWORD got;
396 DWORD conmode = 0;
397
398 TRACE("(%p)\n", str);
399 str[1] = 0; /* Length */
403
404 if(ReadConsoleA(msvcrt_input_console(), buf, str[0], &got, NULL)) {
405 if(buf[got-2] == '\r') {
406 buf[got-2] = 0;
407 str[1] = got-2;
408 }
409 else if(got == 1 && buf[got-1] == '\n') {
410 buf[0] = 0;
411 str[1] = 0;
412 }
413 else if(got == str[0] && buf[got-1] == '\r') {
414 buf[got-1] = 0;
415 str[1] = got-1;
416 }
417 else
418 str[1] = got;
419 }
420 else
421 buf = NULL;
424 return buf;
425}
#define NULL
Definition: types.h:112
BOOL WINAPI GetConsoleMode(HANDLE hConsoleHandle, LPDWORD lpMode)
Definition: console.c:1571
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleMode(HANDLE hConsoleHandle, DWORD dwMode)
Definition: console.c:1608
BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleA(IN HANDLE hConsoleInput, OUT LPVOID lpBuffer, IN DWORD nNumberOfCharsToRead, OUT LPDWORD lpNumberOfCharsRead, IN PCONSOLE_READCONSOLE_CONTROL pInputControl OPTIONAL)
Definition: readwrite.c:1195
static HANDLE msvcrt_input_console(void)
Definition: console.c:42
#define LOCK_CONSOLE
Definition: console.c:33
#define UNLOCK_CONSOLE
Definition: console.c:34
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
const WCHAR * str
#define TRACE(s)
Definition: solgame.cpp:4
#define ENABLE_ECHO_INPUT
Definition: wincon.h:109
#define ENABLE_LINE_INPUT
Definition: wincon.h:108
#define ENABLE_PROCESSED_INPUT
Definition: wincon.h:107

◆ _cprintf()

_ACRTIMP int __cdecl _cprintf ( const char format,
  ... 
)

Definition at line 563 of file console.c.

564{
565 int retval;
567
570 va_end(valist);
571
572 return retval;
573}
int CDECL _vcprintf(const char *format, va_list valist)
Definition: console.c:538
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
char * va_list
Definition: vadefs.h:50
static va_list valist
Definition: printf.c:46
Definition: format.c:58
int retval
Definition: wcstombs.cpp:91

◆ _cputs()

_ACRTIMP int __cdecl _cputs ( const char str)

Definition at line 78 of file console.c.

79{
81 int len, retval = -1;
82
83 if (!MSVCRT_CHECK_PMT(str != NULL)) return -1;
84 len = strlen(str);
85
88 && count == len)
89 retval = 0;
91 return retval;
92}
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleA(IN HANDLE hConsoleOutput, IN CONST VOID *lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved)
Definition: readwrite.c:1468
static HANDLE msvcrt_output_console(void)
Definition: console.c:55
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
#define MSVCRT_CHECK_PMT(x)
Definition: msvcrt.h:378
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum GLsizei len
Definition: glext.h:6722

Referenced by cputs().

◆ _cscanf()

_ACRTIMP int __cdecl _cscanf ( const char format,
  ... 
)

Definition at line 496 of file scanf.c.

497{
499 int res;
500
502 res = vcscanf_l(format, NULL, valist);
503 va_end(valist);
504 return res;
505}
GLuint res
Definition: glext.h:9613

◆ _getch()

_ACRTIMP int __cdecl _getch ( void  )

Definition at line 218 of file console.c.

219{
220 int ret;
221
223 ret = _getch_nolock();
225 return ret;
226}
int CDECL _getch_nolock(void)
Definition: console.c:164
return ret
Definition: mutex.c:146

Referenced by getch().

◆ _getche()

_ACRTIMP int __cdecl _getche ( void  )

Definition at line 354 of file console.c.

355{
356 int ret;
357
361 return ret;
362}
int CDECL _getche_nolock(void)
Definition: console.c:342

Referenced by getche().

◆ _kbhit()

_ACRTIMP int __cdecl _kbhit ( void  )

Definition at line 474 of file console.c.

475{
476 int retval = 0;
477
480 retval = 1;
481 else
482 {
483 /* FIXME: There has to be a faster way than this in Win32.. */
484 INPUT_RECORD *ir = NULL;
485 DWORD count = 0, i;
486
488
489 if (count && (ir = malloc(count * sizeof(INPUT_RECORD))) &&
491 for(i = 0; i < count; i++)
492 {
493 if (ir[i].EventType == KEY_EVENT &&
494 ir[i].Event.KeyEvent.bKeyDown &&
495 ir[i].Event.KeyEvent.uChar.AsciiChar)
496 {
497 retval = 1;
498 break;
499 }
500 }
501 free(ir);
502 }
504 return retval;
505}
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
BOOL WINAPI GetNumberOfConsoleInputEvents(HANDLE hConsoleInput, LPDWORD lpNumberOfEvents)
Definition: console.c:1637
BOOL WINAPI DECLSPEC_HOTPATCH PeekConsoleInputA(IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead)
Definition: readwrite.c:1236
static int __MSVCRT_console_buffer
Definition: console.c:38
#define EOF
Definition: stdio.h:33
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_ EVENT_TYPE EventType
Definition: exfuncs.h:167
#define KEY_EVENT
Definition: wincon.h:156

Referenced by kbhit().

◆ _putch()

_ACRTIMP int __cdecl _putch ( int  c)

Definition at line 309 of file console.c.

310{
312 c = _putch_nolock(c);
314 return c;
315}
int CDECL _putch_nolock(int c)
Definition: console.c:298
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80

Referenced by _cgets(), _getche(), gl_getpass(), putch(), and test_console_putch().

◆ _ungetch()

_ACRTIMP int __cdecl _ungetch ( int  c)

Definition at line 441 of file console.c.

442{
446 return c;
447}
int CDECL _ungetch_nolock(int c)
Definition: console.c:430

Referenced by ungetch().

◆ cgets()

static char * cgets ( char str)
inlinestatic

Definition at line 41 of file conio.h.

41{ return _cgets(str); }

◆ cputs()

static int cputs ( const char str)
inlinestatic

Definition at line 42 of file conio.h.

42{ return _cputs(str); }
_ACRTIMP int __cdecl _cputs(const char *)
Definition: console.c:78

◆ getch()

static int getch ( void  )
inlinestatic

Definition at line 43 of file conio.h.

43{ return _getch(); }
_ACRTIMP int __cdecl _getch(void)
Definition: console.c:218

Referenced by interact(), main(), and tokenize().

◆ getche()

static int getche ( void  )
inlinestatic

Definition at line 44 of file conio.h.

44{ return _getche(); }
_ACRTIMP int __cdecl _getche(void)
Definition: console.c:354

◆ kbhit()

static int kbhit ( void  )
inlinestatic

Definition at line 45 of file conio.h.

45{ return _kbhit(); }
_ACRTIMP int __cdecl _kbhit(void)
Definition: console.c:474

◆ putch()

static int putch ( int  c)
inlinestatic

Definition at line 46 of file conio.h.

46{ return _putch(c); }
_ACRTIMP int __cdecl _putch(int)
Definition: console.c:309

◆ ungetch()

static int ungetch ( int  c)
inlinestatic

Definition at line 47 of file conio.h.

47{ return _ungetch(c); }
_ACRTIMP int __cdecl _ungetch(int)
Definition: console.c:441