|
-
February 13th, 2005, 05:30 AM
#1
check for console input
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 ).
-
February 13th, 2005, 06:27 AM
#2
Re: check for console input
Take a look at the following...
-
February 13th, 2005, 08:59 AM
#3
Re: check for console input
It seems that the link is broken... Actually the whole site is down. I'll check it later.
Last edited by cilu; February 13th, 2005 at 09:05 AM.
-
February 14th, 2005, 05:11 AM
#4
Re: check for console input
Cilu, when you say that you've implemented an observer pattern - have you done this by hand ?
Just to let you know you can write your own events and an event is effectively an inbuilt-observer pattern.
If you're using events then ignore me. It's just in case you hadn't got to events in your C# investigations yet.
Darwen.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|