DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C++ (http://www.daniweb.com/forums/forum8.html)
-   -   Key input (http://www.daniweb.com/forums/thread159292.html)

egolovin Nov 24th, 2008 3:50 pm
Key input
 
I am looking for a command where i can press m and it pulls up my menu function. i feel retarded cause i tried to look it up but i dont know what i should look for exactly

i know qbasic has a inkey command but i cant figure it out on c++

ArkM Nov 24th, 2008 4:09 pm
Re: Key input
 
Qbasic is not a general purpose platform-independent language, it's a concrete implementation of Basic language dialect. No keyboard notion per se in the C++ language. There are lots of keyboard access functions and libraries in C++ implementations.
What's your C++ compiler?

egolovin Nov 24th, 2008 4:11 pm
Re: Key input
 
visual c++

WaltP Nov 24th, 2008 6:28 pm
Re: Key input
 
Your best bet is to press "M<return>" and use
fgets()
to read the input and process the first character. It's portable and will work on ALL compilers.

ArkM Nov 24th, 2008 6:33 pm
Re: Key input
 
Quote:

Originally Posted by egolovin (Post 743764)
visual c++

Have a look at non-standard header <conio.h>. Use getch/getche functions (in console mode applications only - hi, qbasic ;) ). If you are developing GUI application, keyboard key access depends of selected GUI platform...


All times are GMT -4. The time now is 4:00 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC