473,729 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getch() and getche()

Hi,

Does anyone know if it's possible to write either a getch()
(preferably Borland-style) or getche() function in C++ (I've posted
the C equivalent of this question to CLC) without it being
platform-dependent or otherwise non-standard?

If not, can someone suggest a good alternative for situations where
you require the user to "press any key to continue" or "press Enter to
continue" - with getch(), the mistakes that a user can make with
getchar() and the like just don't occur.

Thanks,

James McLaughlin
Apr 3 '06 #1
4 7217
in linux you can use ncurses that already have them
ze************* *********@yahoo .com ha scritto:
Hi,

Does anyone know if it's possible to write either a getch()
(preferably Borland-style) or getche() function in C++ (I've posted
the C equivalent of this question to CLC) without it being
platform-dependent or otherwise non-standard?

If not, can someone suggest a good alternative for situations where
you require the user to "press any key to continue" or "press Enter to
continue" - with getch(), the mistakes that a user can make with
getchar() and the like just don't occur.

Thanks,

James McLaughlin

Apr 3 '06 #2
ze************* *********@yahoo .com wrote:
Hi,

Does anyone know if it's possible to write either a getch()
(preferably Borland-style) or getche() function in C++ (I've posted
the C equivalent of this question to CLC) without it being
platform-dependent or otherwise non-standard?

If not, can someone suggest a good alternative for situations where
you require the user to "press any key to continue" or "press Enter to
continue" - with getch(), the mistakes that a user can make with
getchar() and the like just don't occur.


"Hit any key to continue" is not doable in Standard C++.

"Hit Enter to continue" is doable:

// #includes and surrounding code redacted
std::cout << "Press <Enter> to continue: ";
std::string trash;
std::getline(st d::cin, trash);

Apr 3 '06 #3
Belated thanks to both of you,

James McLaughlin.
May 2 '06 #4
James McLaughlin wrote:
Belated thanks
for what?
to both of you,


both of who?

May 2 '06 #5

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

Similar topics

4
2772
by: VivekR | last post by:
Hi, Consider the program snippet below main { .... printf("Enter Choice: "); int choice = getche();
5
6242
by: Justine | last post by:
Hi All, Which is function equivalent to getch/getche of C++. Thanz in Advance, Justine
28
9880
by: srikanth | last post by:
help me out with the subject
9
3041
by: James McLaughlin | last post by:
Hi, Does anyone know if it's possible to write either a getch() (preferably Borland-style) or getche() function in C without it being platform-dependent or otherwise non-standard? If not, can someone suggest a good alternative for situations where you require the user to "press any key to continue" or "press Enter to continue" - with getch(), the mistakes that a user can make with getchar() and the like just don't occur.
6
5151
by: ppravin88 | last post by:
hi guys 'n' gals .. could anyone tell me the difference between getch(); and getche(); and when and where should we use this function... and also wat is the diff between return(); & return(0); & return(1);..........
0
8763
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9284
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9202
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9148
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6722
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6022
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3238
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 we have to send another system
2
2683
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2165
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.