Design Pattern Examples
Overview of object-oriented design patterns
readkey.cpp
Go to the documentation of this file.
1
5
6#ifdef _MSC_VER
7#include <conio.h>
8#else
9#include <stdio.h>
10#endif
11
12#include "readkey.h"
13
14namespace Helpers
15{
16
17 int readkey()
18 {
19#ifdef _MSC_VER
20 int retval = _getch();
21 if (retval == 0)
22 {
23 retval = _getch();
24 }
25 return retval;
26#else
27 return getchar();
28#endif
29 }
30
31} // end namespace
Declaration of the readkey() function, a blocking read for a key from the keyboard.
The namespace containing all the "helper" functions in the C++ code.
int readkey()
Read a key from the keyboard, blocking if no key is pressed.
Definition: readkey.cpp:17