44 #include <OpenMesh/Tools/Utils/conio.hh> 54 int kbhit() { return ::_kbhit(); }
55 int getch() { return ::_getch(); }
56 int getche() { return ::_getche(); }
62 #elif defined(WIN32) || defined(__MINGW32__) 69 int kbhit() { return ::kbhit(); }
70 int getch() { return ::getch(); }
71 int getche() { return ::getche(); }
81 #if !defined(POSIX_1003_1_2001) 88 #include <sys/ioctl.h> 105 static struct termios Otty, Ntty;
112 Ntty.c_lflag &= ~ICANON;
113 Ntty.c_cc[VMIN] = CMIN;
114 Ntty.c_cc[VTIME] = CTIME;
116 if (0 == (error = tcsetattr(0, TCSANOW, &Ntty)))
119 error += ioctl(0, FIONREAD, &cnt);
120 error += tcsetattr(0, TCSANOW, &Otty);
123 select(1, NULL, NULL, NULL, &tv);
125 return (error == 0 ? cnt : -1 );
133 static struct termios Otty, Ntty;
141 Ntty.c_lflag &= ~ICANON;
142 Ntty.c_lflag &= ~ECHO;
143 Ntty.c_cc[VMIN] = CMIN;
144 Ntty.c_cc[VTIME] = CTIME;
150 # define FLAG TCSAFLUSH 154 # define FLAG TCSANOW 157 if (0 == (error = tcsetattr(0, FLAG, &Ntty)))
159 error = read(0, &ch, 1 );
160 error += tcsetattr(0, FLAG, &Otty);
162 return (error == 1 ? (
int) ch : -1 );
170 static struct termios Otty, Ntty;
178 Ntty.c_lflag &= ~ICANON;
179 Ntty.c_lflag |= ECHO;
180 Ntty.c_cc[VMIN] = CMIN;
181 Ntty.c_cc[VTIME] = CTIME;
187 # define FLAG TCSAFLUSH 191 # define FLAG TCSANOW 194 if (0 == (error = tcsetattr(0, FLAG, &Ntty))) {
195 error = read(0, &ch, 1 );
196 error += tcsetattr(0, FLAG, &Otty);
199 return (error == 1 ? (
int) ch : -1 );
205 #endif // System dependent parts 215 char msg[] =
"press key to continue...";
221 *ptr = islower(tmp) ? toupper(tmp) : tolower(tmp);
222 printf(
"\r%s", msg); fflush(stdout);
229 printf(
"\r%s.", msg); fflush(stdout);
231 printf(
"\r%s..", msg); fflush(stdout);