-
getchar() and variant
Hello,
I need code this below but I need something like a getchar() that doens't wait for the "return" from the user. How can I implement it? (it only wait for a key pressed)
Code:
int ch;
while ( (ch = getchar() ) != '\n') {
cout << "ch " << ch << endl;
}
-
You need to use system specific functions. There is no standard way to do it, but there is a FAQ on the subject "How do I get user input without waiting for Enter" or some such.
--
Mats
-
I should curious to implement it by myself...
-
depending on the platform try kbhit().
-
For Dev-C++, try getche() in <conio.h>. Read the FAQ matsp indicated: http://faq.cprogramming.com/cgi-bin/...&id=1043284392