473,503 Members | 12,425 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Press any key to...

How in the name of Christ can I do this with Standard C++!

Obviously:

std::cout << "Press any key to exit...";

char k;
std::cin >> k;

doesn't work.

All I want is one miserable keystroke.

Does anyone else think that Google is crap for searching
for programming related info?
-JKop
Jul 22 '05 #1
2 2527

"JKop" <NU**@NULL.NULL> wrote in message
news:tA******************@news.indigo.ie...
How in the name of Christ can I do this with Standard C++!

Obviously:

std::cout << "Press any key to exit...";

char k;
std::cin >> k;

doesn't work.

All I want is one miserable keystroke.

Does anyone else think that Google is crap for searching
for programming related info?
-JKop


You can't do this in standard c++, because C++ only has buffered input.
However, using a library local to your platform to accomplish this should be
easy. For example, you might have the ncurses-library available on your
platform.

/ WP
Jul 22 '05 #2
JKop writes:
How in the name of Christ can I do this with Standard C++!

Obviously:

std::cout << "Press any key to exit...";

char k;
std::cin >> k;

doesn't work.

All I want is one miserable keystroke.

Does anyone else think that Google is crap for searching
for programming related info?


I can see why you say that. But it is easy to forget that there are main
branches to google and this question is more likely to get results in google
groups (the old Deja) than the main group. I went to google groups and
typed "press any key" and got lots of promising looking hits on the first
page. I must admit I didn't look at them but the combination of skimming
and trying to guess what the newsgroup title means they are posted to are a
help. Sometimes looking at the number of messages is useful too. You can
also go to advanced search to limit the number of non-germane hits.
Jul 22 '05 #3

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

Similar topics

1
6202
by: asdasd | last post by:
Hello there, I'm hoping someone might be able to help me out. Its been awhile since I've programmed in visual basic (and roughly at that)... I want to create a program that will allow me to...
1
2947
by: Brian Basquille | last post by:
Can i carry out a command during execution with the press of a key? Am working on a Countdown Timer and everytime i press p on the keyboard, i want to add a minute to the timer and every time i...
3
15821
by: John Howard | last post by:
I'm trying to write a simple press any key routine, but am having some problems. Here is the routine: void PressAnyKey () { cout << "Press Any Key"; do{}while (!kbhit()); getch(); cout <<...
6
2436
by: Johan Svedberg | last post by:
Hi! I read somewhere that it is impossible to write a program in ANSI-C which only reads one char from the keyboard without having to press Enter (i.e. -questions). Is this true? -- Johan...
5
20665
by: junk mail | last post by:
My friend is trying to code a small c program where he wants to force the user to press enter and only enter to continue. Currently he is using getchar() with a loop but you can type any number...
0
1942
by: neeraj | last post by:
Hi Everybody I have one problem in my asp.net web application. The problem is that I check the date validation in code behind; if user not gives the valid data and press save button then I fire...
9
64296
by: Susan Rice | last post by:
I'm running a simple win32 console application and I want to impliment a "Press any key to continue", so I print that prompt, and then what's the easiest way to impliment reading any key? Do I use...
1
6964
by: daonho | last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the...
1
2337
by: =?Utf-8?B?QXNhZg==?= | last post by:
Hello, I have a Default.aspx page with several controls in a Master Page. When pressing on a Button control Page_Load event is fired on the Default.aspx page and after that the Page_Load event...
3
3464
by: win | last post by:
How to get the keycode press in a web form Vincent
0
7212
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
7364
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
7017
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
5604
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
5026
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
3186
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
405
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.