We can use ASCII to judge which normal key is pressed in C, but how can I get a composite key, I know we can catch signal to get "Ctrl+C" and so on. but how about other composite keys, for example: "Ctrl+K."
Asked
Active
Viewed 128 times
2 Answers
1
ASCII has control codes as well.
http://academic.evergreen.edu/projects/biophysics/technotes/program/ascii_ctrl.htm
For example Ctrl+K
can be detected by checking the return code of getchar()
for value 11
.

artm
- 17,291
- 6
- 38
- 54
1
To read all control characters, even those that are normally interpreted by your terminal (and so would not be available as program input) you would have to switch to raw "uncooked" IO. This question deals with raw IO: Unbuffered I/O in ANSI C