cilu
February 13th, 2005, 04:30 AM
I was wondering how can I get the same effect of kbhit() from C/C++ in a C# console based application, i.e. do something (like stop the application) the moment a key was pressed?
I have created this console based app, with this observer pattern: I have a clock subject with a timer that periodically updates its observers which display the time in the console. The thing is I want to stop it the moment I press a key, any key (and I don't want to use Ctrl+C ;) ).
I have created this console based app, with this observer pattern: I have a clock subject with a timer that periodically updates its observers which display the time in the console. The thing is I want to stop it the moment I press a key, any key (and I don't want to use Ctrl+C ;) ).