This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
In the following program the user has a simple menu with 3 choices. Two choices (a & b) will run specific methods and the final choice will quit the program. Is there a simple way to ask the user to press a key (once the called method is done) to return to the main menu, rather than returning automatically?
I'll interpret that to mean that you want to be able to read from System.in without waiting for the user to press enter - is that right? If so, it's your OS console, not Java's buffering of System.in that prevents it, and consequently unbuffering System.in (alone) won't let you do it.
On unix-like platforms, you can use "stty -icanon min 1" to change console mode so you can do character-at-a-time input. On other operating systems, I have no idea.
I tried a few different combinations of input streams, only after using 'stty -icanon min 1' can I read input without waiting for an 'Enter'. This is on linux.
Is this kind of 'unbuffered' input from console enabled by default on windows? I remember writing C programs to read standard input without waiting for an 'Enter' on windows systems.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com