By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,433 Members | 1,797 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,433 IT Pros & Developers. It's quick & easy.

Combime keys

P: n/a
Hi all
I want to use combine keys in my code such as ctrl+w or or Alt or F
keys.What should I do? and is there any special data type which I use
for this purpose?

Nov 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
In article <11**********************@g47g2000cwa.googlegroups .com>,
<pa****@gmail.com> wrote:
I want to use combine keys in my code such as ctrl+w or or Alt or F
keys.What should I do? and is there any special data type which I use
for this purpose?


There is no standard C portable method of doing that: the execution
set of C does not assume ASCII or any other character set, and
so does not assume that control characters even exist.

I would suggest that you review the recent "arrow keys" thread;
my suspicion is that after that, the next stop for you should be
a Windows programming newsgroup.

--
I am spammed, therefore I am.
Nov 15 '05 #2

P: n/a
pa****@gmail.com writes:
I want to use combine keys in my code such as ctrl+w or or Alt or F
keys.What should I do? and is there any special data type which I use
for this purpose?


There's no way to do this in portable C.

Some key combinations may show up as single characters, depending on
how you read them. For example, if you read a control-w using
getchar(), you'll probably see a single '\x17' character (assuming
ASCII and the usual semantics of the control key). If you use a
lower-level interface, you might see the keystrokes separately, but
that's *extremely* system-specific.

In general, portable C can't read a single character or keystroke
without waiting for the end of the line. See question 19.1 of the
C FAQ <http://www.eskimo.com/~scs/C-faq/top.html>.

The particular character sequences produced by particular keystrokes
(control-w, alt-f, F1, etc.) are system-specific.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.