Wednesday 16 November 2011

How do I move the cursor with the ANSI driver? in C programming

How do I move the cursor with the ANSI driver?

There are two ways to move the cursor, relative motion and absolute motion. Relative motion is measured from the place where the cursor currently is; for example, “Move the cursor up two spaces.” Absolute placement is measured from the upper-left corner of the screen; for example, “Move the cursor to the 10th
row, column 5.”

Relative motion is carried out in the following fashion:

<esc>[#a in which # is the number of spaces to move up.
<esc>[#b in which # is the number of spaces to move down.
<esc>[#c in which # is the number of spaces to move right.
<esc>[#d in which # is the number of spaces to move left.
To move the cursor to an absolute location, you do this:

<esc>[<row>;<col>H in which row and col are the row and column at which you want the cursor
to be positioned.

Cross Reference:

None.

No comments:

Post a Comment