经常见大家在问printf("\027[10")等是什么意思
这种就是VT100控制码
用于控制屏幕等终端设备的属性
同样可以向打印机等输出
VT100以ESC开始,在TELNET终端上同样可以使用VT100命令实现光标移动等终端控制操作
现列出如下
[code:1:d53c3430e0]
Article 248 of comp.terminals:
Newsgroups: comp.terminals
Path: cs.utk.edu!gatech!udel!bogus.sura.net!opusc!usceast!chan
From: [email protected] (Simon Chan)
Subject: VT100 Reference Card !! ( if you are looking for....)
Message-ID: <chan.728236678@hertz>
Keywords: vt100 terminal escape codes
Sender: [email protected] (USENET News System)
Organization: USC Department of Computer Science
Date: 28 Jan 93 15:57:58 GMT
Lines: 162
Taken from VT100 Programming Reference Card (DIGITAL)
ANSI Compatible Mode
Cursor Movement Commands
Cursor up ESC [ Pn A
Cursor down ESC [ Pn B
Cursor forward (right) ESC [ Pn C
Cursor backward (left) ESC [ Pn D
Direct cursor addressing ESC [ Pl; Pc H or
ESC [ Pl; Pc f
Index ESC D
Next Line ESC E
Reverse index ESC M
Save cursor and attributes ESC 7
Restore cursor and attributes ESC 8
* Pn = decimal parameter in string of ASCII digits.(default 1)
* Pl = line number (default 0); Pc = column number (default 0)
Line Size (Double-Height and Double-Width) Commands
Change this line to double-height top half ESC # 3
Change this line to double-height bottom half ESC # 4
Change this line to single-width single-height ESC # 5
Change this line to double-width single-height ESC # 6
Character Attributes
ESC [ Ps;Ps;Ps;...,Ps m
Ps = 0 or None All Attributes Off
1 Bold on
4 Underscore on
5 Blink on
7 Reverse video on
Any other parameter values are ignored.
Erasing
From cursor to end of line ESC [ K or ESC [ 0 K
From beginning of line to cursor ESC [ 1 K
Entire line containing cursor ESC [ 2 K
From cursor to end of screen ESC [ J or ESC [ 0 J
From beginning of screen to cursor ESC [ 1 J
Entire screen ESC [ 2 J
Programmable LEDs
ESC [ Ps;Ps;...Ps q
Ps = 0 or None All LEDs Off
1 L1 on
2 L2 on
3 L3 on
4 L4 on
Any other parameter values are ignored.
Character Set (G0 and G1 Designators)
Charactor Set G0 Designator G1 Designator
United Kingdom (UK) ESC ( A ESC ) A
United States (USASCII) ESC ( B ESC ) B
Special graphics characters ESC ( 0 ESC ) 0
and line drawing set
Alternate character ROM ESC ( 1 ESC ) 1
Alternate character ROM ESC ( 2 ESC ) 2
special graphics characters