View Full Version : MS DOS not pausing while waiting for imput.

Jeremy G
11-08-2001, 10:12 PM
Is there a way to check for imput with out pausing and promting for imput? if i use:
cin >> somecharacter;
it pauses everything and waits till you give a character. How can i ask for imput and keep my program going.


11-09-2001, 12:52 PM
int main()
char Input=0;
while(Input!=27) //Loop while ESC is not pressed.
if(kbhit()) Input=getch(); //Store the pressed key (if a key is pressed)

//Your code


Justin W
11-14-2001, 09:06 PM
For that code to work, don't forget to #include <conio.h>