473,498 Members | 1,544 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to pause for keystroke...

In a console based application, I'd like to pause for a
keystroke. I thought Console.Read would do the trick, but
after it didn't I found this on the MSDN description of
the function:

Console.Read
This method will not return until the read operation is
terminated; for example, by the user pressing the enter
key.

I'd like the program to continue, no matter what key they
press. Thank you in advance.
Nov 16 '05 #1
5 4780
Just delegate the console reading to another thread.

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/
"Aaron" <aa***@digitaldelay.net> wrote in message
news:10****************************@phx.gbl...
In a console based application, I'd like to pause for a
keystroke. I thought Console.Read would do the trick, but
after it didn't I found this on the MSDN description of
the function:

Console.Read
This method will not return until the read operation is
terminated; for example, by the user pressing the enter
key.

I'd like the program to continue, no matter what key they
press. Thank you in advance.

Nov 16 '05 #2
Hey,

I haven't gotten that far in my C# book lol. But I do
understand the concept. I have O'Reilly's Programming C#
by Jesse Liberty. Although the book is rather good, there
are a few things I don't like about it. She spends a lot
of time on certain subjects that I find are easy to
understand and not enough time on other subjects that are
little more involved. The most annoying aspects are some
of the example applications with show of the new features
she's explaining without any real example of real-world
application. Another annoying tidbit is that the chapter
on IO is one of the very last.

You recommend any other books? I find one book on a
programming language is never enough. ;)
-----Original Message-----
Just delegate the console reading to another thread.

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/
"Aaron" <aa***@digitaldelay.net> wrote in message
news:10****************************@phx.gbl...
In a console based application, I'd like to pause for a
keystroke. I thought Console.Read would do the trick, but after it didn't I found this on the MSDN description of
the function:

Console.Read
This method will not return until the read operation is
terminated; for example, by the user pressing the enter
key.

I'd like the program to continue, no matter what key they press. Thank you in advance.

.

Nov 16 '05 #3
Hi Aaron,

I would recommend Professional C# from Wrox.

PS: Jesse Liberty is a 'he' :)

HTH,
Rakesh Rajan

"Aaron" wrote:
Hey,

I haven't gotten that far in my C# book lol. But I do
understand the concept. I have O'Reilly's Programming C#
by Jesse Liberty. Although the book is rather good, there
are a few things I don't like about it. She spends a lot
of time on certain subjects that I find are easy to
understand and not enough time on other subjects that are
little more involved. The most annoying aspects are some
of the example applications with show of the new features
she's explaining without any real example of real-world
application. Another annoying tidbit is that the chapter
on IO is one of the very last.

You recommend any other books? I find one book on a
programming language is never enough. ;)
-----Original Message-----
Just delegate the console reading to another thread.

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/
"Aaron" <aa***@digitaldelay.net> wrote in message
news:10****************************@phx.gbl...
In a console based application, I'd like to pause for a
keystroke. I thought Console.Read would do the trick, but after it didn't I found this on the MSDN description of
the function:

Console.Read
This method will not return until the read operation is
terminated; for example, by the user pressing the enter
key.

I'd like the program to continue, no matter what key they press. Thank you in advance.

.

Nov 16 '05 #4
Rakesh,

A 'he'? The 'Programming C#' book provides no clue as to
his gender. I do actually have a 'Teach Yourself C++ in 21
Days' book that he wrote; and upon reviewing the back
cover, I see that he is a 'he.' ;) Never really noticed.
Thanks!

I just finished reading the chapter on Delegates and
Events. Although I do like the book and overall the
explainations are thorough and easy to understand, the
book is sometimes very aggrivating. There are many cases
where he talks about syntax and certain aspects of how to
accomplish something using excerpts from a source which he
reveals serveral pages later. The issue, many of these
excerts are incorrect and don't match the source he later
uses; many instances where he fails to put colons or
parenthesis after a function, etc.

Thanks for the book recommendation; I'll definitely check
it out.
-----Original Message-----
Hi Aaron,

I would recommend Professional C# from Wrox.

PS: Jesse Liberty is a 'he' :)

HTH,
Rakesh Rajan

"Aaron" wrote:
Hey,

I haven't gotten that far in my C# book lol. But I do
understand the concept. I have O'Reilly's Programming C# by Jesse Liberty. Although the book is rather good, there are a few things I don't like about it. She spends a lot of time on certain subjects that I find are easy to
understand and not enough time on other subjects that are little more involved. The most annoying aspects are some of the example applications with show of the new features she's explaining without any real example of real-world
application. Another annoying tidbit is that the chapter on IO is one of the very last.

You recommend any other books? I find one book on a
programming language is never enough. ;)
>-----Original Message-----
>Just delegate the console reading to another thread.
>
>- Sahil Malik
>http://codebetter.com/blogs/sahil.malik/
>
>
>"Aaron" <aa***@digitaldelay.net> wrote in message
>news:10****************************@phx.gbl...
>> In a console based application, I'd like to pause for a >> keystroke. I thought Console.Read would do the trick,
but
>> after it didn't I found this on the MSDN description

of >> the function:
>>
>> Console.Read
>> This method will not return until the read operation is >> terminated; for example, by the user pressing the enter >> key.
>>
>> I'd like the program to continue, no matter what key

they
>> press. Thank you in advance.
>
>
>.
>

.

Nov 16 '05 #5
Yeah Jesse Liberty is a "he" ; bet he's pissed off when you call him a
"She".

Besides that - you are gonna have to read up about System.Threading
namespace - it ain't that tough - but I don't know any books off the top of
my head. Google for a sample.
--

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/


"Aaron" <aa***@digitaldelay.net> wrote in message
news:10****************************@phx.gbl...
Hey,

I haven't gotten that far in my C# book lol. But I do
understand the concept. I have O'Reilly's Programming C#
by Jesse Liberty. Although the book is rather good, there
are a few things I don't like about it. She spends a lot
of time on certain subjects that I find are easy to
understand and not enough time on other subjects that are
little more involved. The most annoying aspects are some
of the example applications with show of the new features
she's explaining without any real example of real-world
application. Another annoying tidbit is that the chapter
on IO is one of the very last.

You recommend any other books? I find one book on a
programming language is never enough. ;)
-----Original Message-----
Just delegate the console reading to another thread.

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/
"Aaron" <aa***@digitaldelay.net> wrote in message
news:10****************************@phx.gbl...
In a console based application, I'd like to pause for a
keystroke. I thought Console.Read would do the trick, but after it didn't I found this on the MSDN description of
the function:

Console.Read
This method will not return until the read operation is
terminated; for example, by the user pressing the enter
key.

I'd like the program to continue, no matter what key they press. Thank you in advance.

.

Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2695
by: Ste | last post by:
Hello, my goal would be implementing some keystroke analysis using php. I'm a novice in php, so i ask your advice: according to you, is it possible to log each keystroke client-side even if php is...
7
6213
by: hokieghal99 | last post by:
Does anyone know of a keystroke logger that has been written in Python for Windows machines? I'd like to see such a script and use it as a point of reference for a real-time backup project that I'm...
2
3213
by: Wayne Wengert | last post by:
I want to get the decimal (integer) value of user keystrokes. I am using the following code. chrInput is the character entered (e.g. "M") and "keystroke is DIMed as Short keystroke =...
1
1900
by: Amin Gunawan via .NET 247 | last post by:
I would like to put a combo box in a column of a datagrid. I've seen the samples in the MSDN library of other sources, butall samples didn't catch the 'DOWN/UP' keystroke. It means thatwhen I select...
15
5719
by: Frank Bormann | last post by:
Hi, probably a stupid question, but I haven't been able to find anything. Is there a istream related function that let me read exactly one keystroke from the keyboard through cin? What I...
11
39850
by: Paminu | last post by:
Is there something like system("PAUSE") for linux?
8
36397
by: Wim | last post by:
My GUI application starts a process (a console program) when the user hits Play. I would like to add an option to pause that process. The code I've added to detect if the user hit pause/unpause...
3
1448
by: GG | last post by:
I have a console app that when it is run and I press a key then it freezes till a press another key gain. Is there a way to avoid it that is the keystrokes do not pause the app? Thanks ...
0
1335
by: jorgetheawesome | last post by:
Hi! I was writing a program, and for debugging, used the system("pause") command. I am running Windows XP. Its an MS-DOS app, programmed in Dev-C++. But the program, when compiled, runs...
0
7126
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
7168
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
7210
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...
1
6891
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5465
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4916
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4595
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1424
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
293
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.