954,157 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

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++

egolovin
Newbie Poster
11 posts since Oct 2008
Reputation Points: 10
Solved Threads: 0
 

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?

ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
 

visual c++

egolovin
Newbie Poster
11 posts since Oct 2008
Reputation Points: 10
Solved Threads: 0
 

Your best bet is to press "M" and use fgets() to read the input and process the first character. It's portable and will work on ALL compilers.

WaltP
Posting Sage w/ dash of thyme
Moderator
10,492 posts since May 2006
Reputation Points: 3,348
Solved Threads: 943
 
visual c++


Have a look at non-standard header . 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...

ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You