Combime keys

P

paytam

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?
 
W

Walter Roberson

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.
 
K

Keith Thompson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,170
Messages
2,570,927
Members
47,469
Latest member
benny001

Latest Threads

Top