Sunday, November 24, 2013

Replacement for _getch()?

Newsgroup: comp.lang.c++

Subject: Replacement for _getch()?

From: Geoff <geoff@...>

Date: Fri, 22 Nov 2013 08:25:07 -0800



The Microsoft _getch() function gets a character from the console

without echo. It does not require a carriage return. It returns the

character (int) read and does not have an error return. This makes it

very handy for console applications that want to wait for a single

keystroke from the user or for password inputs where echo is

problematic.



Is there a replacement for this non-standard function in C++?



std::cin.ignore() and std::cin.get() fail as direct replacements since

they require the enter key and not just any key be pressed.



Solutions involving ncurses or unistd.h are unsatisfactory for the

same reason conio.h is unsatisfactory.







via Usenet Forums - Usenet Search,Free Usenet - comp.lang.c++ http://www.pocketbinaries.com/usenet-forums/showthread.php?133989-Replacement-for-_getch()&goto=newpost

View all the progranning help forums at:

http://www.pocketbinaries.com/usenet-forums/forumdisplay.php?128-Coding-forums

No comments:

Post a Comment