cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Inputing Data w/o Pressing Enter
Inputing Data w/o Pressing Enter
Nov 17, 2010 at 12:30am UTC
Nastix
(2)
Is there any way to allow the user to input a single character/int without requiring them to press enter in order to continue with the program?
Nov 17, 2010 at 12:48am UTC
Disch
(13742)
Yes, but they're all nonstandard. You can use platform specific APIs or you can get a crossplatform lib like ncurses.
Although -- you typically should not do this in a console program. Why do you want to do it?
Nov 17, 2010 at 12:53am UTC
Nastix
(2)
I made a black jack game but it just seems repetitive hitting enter after each player hits/stands. I'd like it to where after the user enter's 'h' for hit or 's' for stand, it goes immediately to the next option.
Nov 17, 2010 at 3:21am UTC
Duthomhas
(13206)
Correction -- they are all standard; they are also platform-specific.
The C and C++ standards don't address device issues (like tty terminals). Each OS/platform has its own specific way of handling it.
NCurses +1
(links to get started with curses)
http://www.cplusplus.com/forum/windows/15935/#msg79025
Nov 17, 2010 at 3:24am UTC
Disch
(13742)
Rather than install NCurses, I would get a lib for making games, since you want to make a game.
Obligatory link:
http://cplusplus.com/forum/articles/28558/
Topic archived. No new replies allowed.