I don't think it's possible. Whenever you type something it is stored in the variable, therefor you need an if statement, but I would suggest to wait for other people responses as well in case someone has a better answer.
Actually there is something that can simulate that.
Write a thread that keeps running in parallel with your main. Whenever you read the input set a local variable defined in the Thread. The Thread in its run method will keep checking the value of that variable in an endless loop. If "quit" is found you will break from the loop and call the quit in the run method.
Although you will need to be careful not to leave any unfinished business in the main, so you might want to pass more variables to the Thread from the main, so it will monitor the state of the main
Reputation Points: 1014
Solved Threads: 446
Nearly a Senior Poster
Offline 3,260 posts
since Dec 2007