ANSI ESCAPE SEQUENCES
Ed de_Moel
demoel at ruunsa.fys.ruu.nl
Mon Nov 12 19:00:32 AEST 1990
In <102019 at cc.utah.edu> PRASAD at cc.utah.edu writes:
>Hi
> This is my first posting to this newsgroup
>I wanted to know the ANSI screen control escape sequences
>e.g
>clear screen
>position cursor
>etc
>thanks in advance
>Prasad
The ANSI standard for device control (not just CRT's but any
output device!) exists since 1979. It really amazes me
that UNIX people, unlike the rest of the world keep using
non-standard (and hence non-portable) code using termcaps
libraries.
(Sorry, this was really aimed at a different letter in this
group).
Your escape-sequences are:
Position cursor: <esc> [ y-coordinate ; x-coordinate H
Clear screen: <esc> [ J
The coordinate system for a CRT is:
- left upper corner is <esc>[1;1H
- right lower corner is <esc>[24;80H
Note that cursor positioning and erasing are separate operations,
so if you want to clear the screen and put the cursor in the upper
left corner:
<esc>[H<esc>[J
(Hey: 1;1 is obviously default).
The above codes are for 7-bit transmission, but will also work
for 8-bit transmission. If you are using 8-bit transmission, you
may abbreviate <esc>[ to <csi>.
Note: <esc> = ASCII code 27 (decimal) 7-bit introducer 1st char
; = 27 + 32 parameter-separator
[ = 27 + 64 7-bit introducer 2nd char
<csi> = 27 + 128 8-bit introducer only char
The complete text of ANSI X3-64/1979 can be obtained through
your national normalization institute, which is probably
ANSI in New York.
Success !
Ed.
More information about the Comp.lang.c
mailing list