943,865 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 594
  • C++ RSS
Nov 24th, 2008
0

Key input

Expand Post »
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++
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
egolovin is offline Offline
11 posts
since Oct 2008
Nov 24th, 2008
0

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?
Reputation Points: 1234
Solved Threads: 347
Postaholic
ArkM is offline Offline
2,001 posts
since Jul 2008
Nov 24th, 2008
0

Re: Key input

visual c++
Reputation Points: 10
Solved Threads: 0
Newbie Poster
egolovin is offline Offline
11 posts
since Oct 2008
Nov 24th, 2008
0

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.
Last edited by WaltP; Nov 24th, 2008 at 6:28 pm.
Moderator
Reputation Points: 3278
Solved Threads: 892
Posting Sage
WaltP is offline Offline
7,718 posts
since May 2006
Nov 24th, 2008
0

Re: Key input

Click to Expand / Collapse  Quote originally posted by egolovin ...
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...
Reputation Points: 1234
Solved Threads: 347
Postaholic
ArkM is offline Offline
2,001 posts
since Jul 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Simple C++ Class problem
Next Thread in C++ Forum Timeline: setting size of 2-D array at constructor issue





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC