473,387 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Need help implementing Console-based program pauses (Press Enter/Any Key to continue)

32
I'm in an intro to computer programming course and just for the purposes of my test drivers and personal implementation, I would like to know if it is possible to force the program to wait for the enter key before proceeding without allowing the user to type in anything. I don't really have any experience with the buffered reader, we were provided with an IO class that handles inputs. Currently I solve it with a String input that doesnt go anywhere, but this looks unprofessional when you are able to type characters other than enter. (In professional programs that have "press enter to continue" generally nothing is shown when other keys are pressed. ) I'm willing to learn the whole buffered reader thing, but I currently don't know enough about it to even know if its the right tool for this or whether there is something else that performs this way.

I'm also interested in the "press any key to continue" operation if anyone knows how to implement this.
Nov 3 '06 #1
4 2604
kotoro
32
I know it appears that this issue has been dealt with in some other posts, but those answers still apparrently allow the user to type a string.
Nov 3 '06 #2
r035198x
13,262 8TB
You need a writer not a reader with a combination of KeyEvent handling. On keyPress write nothing to the console if the key is not enter.
Nov 3 '06 #3
kotoro
32
could you show me an example of this so I have an idea of how to implement it? I've never used key event or writer method calls, so I dont even know what their names are.
Nov 3 '06 #4
r035198x
13,262 8TB
could you show me an example of this so I have an idea of how to implement it? I've never used key event or writer method calls, so I dont even know what their names are.
I do not have any examples. If you are new to programming then it maybe a while before you do event handling.
Nov 3 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Pavils Jurjans | last post by:
Hello, please consider the code at the end of this posting, that depicts simple case of custom enumerator. This particular example will enumerate over list of random number within 1..10, and will...
8
by: hex | last post by:
Hi I make a class "MyClass" and this clas implements the Interface ICloneable. I want when I instance an object from MyClass and I call obj.Clone() it returns an object of MyClass type. for...
4
by: John C | last post by:
I'm new to C#, so just point me at the correct reference material if this question has been answered before. When creating a new class which implements the IDictionary interface, two versions of...
0
by: Matt Sipes via DotNetMonster.com | last post by:
my C# code interface: namespace IShared; { public interface IChannelEntity { void SendMsg(string p_msg); void Exit(); } public interface IChannelEntityCallBack
0
by: Tony Archer | last post by:
Here's my problem... When I use this code to hit the site in question I'm redirected to another SSL login page. If processed successfully the page creates a cookie and then redirects you to the...
2
by: Alok Sathaye | last post by:
Hi, I have an XSLT which outputs an <xsl:message> How can I handle it using .net framework 1.1 I know 2.0 has provided an event to trp the message. Is something similiar possible in 1.1 also? ...
7
by: Edward Diener | last post by:
Since implement the assign operator for reference types eliminates the ability to assign a reference object to a reference variable of the same type or base class of that type, I assume that...
17
by: nicolas.hilaire | last post by:
Hi all, i've read this article http://msdn2.microsoft.com/en-us/library/85af44e9.aspx who first interest me much. I've translated it to use generic instead of template : generic < typename ...
1
by: Charles | last post by:
Hi all, I need C# code for Implementing MD5 Algorithm.. Hope all would have heard of MD5 Algorith... Does any one have the C# coding for that Algorithm.. please Send... ITs URgent..... Thanks...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.