Results 1 to 6 of 6

Thread: move caret in dos console

  1. #1
    DaoK
    Guest

    move caret in dos console

    Hello,
    How can I move the caret in the dos console, with the X,Y coord ?

  2. #2
    jim mcnamara
    Guest
    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);

  3. #3
    DaoK
    Guest
    I am using MVC++6.0 and when I use your code I have some weird character in the dos console

  4. #4
    jim mcnamara
    Guest
    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

  5. #5
    DaoK
    Guest
    Why it print all character and do not move the carret ?

  6. #6
    DaoK
    Guest
    here is my solution :

    Code:
    BOOL SetConsoleCursorPosition(
      HANDLE hConsoleOutput,  // handle to console screen buffer
      COORD dwCursorPosition   // new cursor position coordinates
    );

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width