首页 > 代码库 > CTRL key

CTRL key

ctrl key其实是用于扩展键盘,单独一个ctrl键没有什么作用,也没有ascii码,当与其他键相结合时,相当于创造出一个新键。例如:用getchar()侦测输入的字符,当按下ctrl+a时,只输出了一个ascii码1。只按下ctrl键没有输出。因此ctrl+a其实只相当于一个键罢了。

下表为所有的ctrl组合键的ascii码及其名字。

Control Code To Enter With Echo
AbbreviationFull NameDecHexAlt-KeyCtrl-Key
 
NULNull000 Ctrl-@^@
SOHStart of heading101Alt-1Ctrl-A^A
STXStart of text202Alt-2Ctrl-B^B
ETXEnd of text303Alt-3Ctrl-C^C
EOTEnd of transmission404Alt-4Ctrl-D^D
ENQEnquiry505Alt-5Ctrl-E^E
ACKAcknowledge606Alt-6Ctrl-F^F
BELBell707Alt-7Ctrl-G^G
BSBackspace808Alt-8Ctrl-H^H
HTHorizontal tab909Alt-9Ctrl-I^I
LFLine feed100AAlt-10Ctrl-J^J
VTVertical tab110BAlt-11Ctrl-K^K
FFForm feed120CAlt-12Ctrl-L^L
CRCarriage return130DAlt-13Ctrl-M^M
SOShift out140EAlt-14Ctrl-N^N
SIShift in150FAlt-15Ctrl-O^O
DLEData line escape1610Alt-16Ctrl-P^P
DC1Device control 11711Alt-17Ctrl-Q^Q
DC2Device control 21812Alt-18Ctrl-R^R
DC3Device control 31913Alt-19Ctrl-S^S
DC4Device control 42014Alt-20Ctrl-T^T
NAKNegative acknowledge2115Alt-21Ctrl-U^U
SYNSynchronous idle2216Alt-22Ctrl-V^V
ETBEnd transmission block2317Alt-23Ctrl-W^W
CANCancel2418Alt-24Ctrl-X^X
EMEnd of medium2519Alt-25Ctrl-Y^Y
SUBSubstitute261AAlt-26Ctrl-Z^Z
ESCEscape271BAlt-27Ctrl-[^[
FSFile separator281CAlt-28Ctrl-\^\
GSGroup separator291DAlt-29Ctrl-]^]
RSRecord separator301EAlt-30Ctrl-^^^
USUnit separator311FAlt-31Ctrl-_^_

CTRL key