49 #include <OpenMesh/Tools/Utils/conio.hh>
59 int kbhit() { return ::_kbhit(); }
60 int getch() { return ::_getch(); }
61 int getche() { return ::_getche(); }
74 int kbhit() { return ::kbhit(); }
75 int getch() { return ::getch(); }
76 int getche() { return ::getche(); }
86 #if !defined(POSIX_1003_1_2001)
93 #include <sys/ioctl.h>
109 static struct termios Otty, Ntty;
116 Ntty.c_lflag &= ~ICANON;
117 Ntty.c_cc[VMIN] = CMIN;
118 Ntty.c_cc[VTIME] = CTIME;
120 if (0 == (error = tcsetattr(0, TCSANOW, &Ntty)))
123 error += ioctl(0, FIONREAD, &cnt);
124 error += tcsetattr(0, TCSANOW, &Otty);
127 select(1, NULL, NULL, NULL, &tv);
129 return (error == 0 ? cnt : -1 );
137 static struct termios Otty, Ntty;
145 Ntty.c_lflag &= ~ICANON;
146 Ntty.c_lflag &= ~ECHO;
147 Ntty.c_cc[VMIN] = CMIN;
148 Ntty.c_cc[VTIME] = CTIME;
154 # define FLAG TCSAFLUSH
158 # define FLAG TCSANOW
161 if (0 == (error = tcsetattr(0, FLAG, &Ntty)))
163 error = read(0, &ch, 1 );
164 error += tcsetattr(0, FLAG, &Otty);
166 return (error == 1 ? (
int) ch : -1 );
174 static struct termios Otty, Ntty;
182 Ntty.c_lflag &= ~ICANON;
183 Ntty.c_lflag |= ECHO;
184 Ntty.c_cc[VMIN] = CMIN;
185 Ntty.c_cc[VTIME] = CTIME;
191 # define FLAG TCSAFLUSH
195 # define FLAG TCSANOW
198 if (0 == (error = tcsetattr(0, FLAG, &Ntty))) {
199 error = read(0, &ch, 1 );
200 error += tcsetattr(0, FLAG, &Otty);
203 return (error == 1 ? (
int) ch : -1 );
209 #endif // System dependent parts
219 char msg[] =
"press key to continue...";
225 *ptr = islower(tmp) ? toupper(tmp) : tolower(tmp);
226 printf(
"\r%s", msg); fflush(stdout);
233 printf(
"\r%s.", msg); fflush(stdout);
235 printf(
"\r%s..", msg); fflush(stdout);