可能重复:
How to read or capture Ctrl+some key or Alt+some key in C?
代码段:
char ks;
ks=getch(); // getting the keystroke : if non ascii then 2 bytes returned : 1st 0 then //scancode
if(ks==0) // if there's no ascii then get the scan code
ks=getch();
printf("%d",ks); // would print ascii if ks !=0 else scan code
//end
alt和控制键不输出,而ctrl + e输出为5。我不明白,请解释一下。
答案 0 :(得分:0)
Ctrl, Alt, Shift
不是字符,在字符流中找不到要读的内容。