Hello,
How can I move the caret in the dos console, with the X,Y coord ?
Printable View
Hello,
How can I move the caret in the dos console, with the X,Y coord ?
Code:void set_cursor(int x, int y){
char esc=27;
char cx,cy
cx=x;
cy=y;
printf("%c[%c;%cH",esc,cx,cy);
I am using MVC++6.0 and when I use your code I have some weird character in the dos console :(
I did that from memory. It is supposed to be an ansi escape sequence for cursor positioning. Which works in DOS Console mode.
Rather than rely on what I don't remember correctly translate the escape sequences from this pageto your own use:
http://enterprise.aacc.cc.md.us/~rhs/ansi.html
Why it print all character and do not move the carret ?
here is my solution :
Code:BOOL SetConsoleCursorPosition(
HANDLE hConsoleOutput, // handle to console screen buffer
COORD dwCursorPosition // new cursor position coordinates
);