VT control code
VT100 is a terminal type definition, and VT100 control code is used to expand the display code on the terminal. For any coordinate on the terminal
Different color display characters.
All the control operators are \ 033 headers (that is, the esc ascii code) and are output using the output character statement. Echo can be used in the command line
Or use printf in the C program to output control characters of VT100.
There are two specific formats,
A digital form,
\ 033 [<number> m.
For example, \ 033 [40 m, indicating that the background black output \ 033 [0 m indicates that the previous settings are canceled.
The other is the control character form.
\ 033 [K clear content from cursor to end of line
\ 033 [the nC cursor shifts n rows right
The ^ [can also be used for output.
VT100 control code
The VT100 control code is classified as follows.
\ 033 [0 m close all attributes
\ 033 [1 m set high brightness
\ 033 [4 m underline
\ 033 [5 m flashing
\ 033 [7 m reverse display
\ 033 [8 m blanking
\ 033 [30 m -- \ 033 [37 m set the foreground color
\ 033 [40 m -- \ 033 [47 m set the background color
\ 033 [move the nA cursor up n rows
\ 033 [move the nB cursor down n rows
\ 033 [the nC cursor shifts n rows right
\ 033 [nD cursor shifts n rows left
\ 033 [y; xH: Set the cursor position
\ 033 [2J clear screen
\ 033 [K clear content from cursor to end of line
\ 033 [s Save the cursor position
\ 033 [u restore cursor position
\ 033 [? 25l hide the cursor
\ 033 [? 25 h show cursor
VT100 color description.
The color output of VT100 is divided into foreground Character Color and background color.
Color Range: 40----49
40: Black
41: dark red
42: Green
43: Yellow
44: Blue
45: Purple
46: dark green
47: white
Color: 30-----------39
30: Black
31: red
32: Green
33: Yellow
34: Blue
35: Purple
36: dark green
37: white
The output string is complete as follows:
Echo "\ 033 [background color; font color m string \ 033 [0 m"
Example:
Echo "\ 033 [41; 36 m something here \ 033 [0 m"
Definition of VT100 Programming
Fixed and difficult programming, such as VT100, can be fully defined using macros to simplify programming.