Combime keys

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • paytam@gmail.com

    #1

    Combime keys

    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?

  • Walter Roberson

    #2
    Re: Combime keys

    In article <1131390634.199 377.287840@g47g 2000cwa.googleg roups.com>,
    <paytam@gmail.c om> wrote:[color=blue]
    >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?[/color]

    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.

    Comment

    • Keith Thompson

      #3
      Re: Combime keys

      paytam@gmail.co m writes:[color=blue]
      > 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?[/color]

      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_Keit h) kst-u@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.

      Comment

      Working...