Skip to content

print text at any position without ncurses

Move your cursors to any position and print, it does the way just like how to change the color and attributes of the font illustrated at previous post.

Specified x and y position, and print a line “Hello World!”


//positioning
void gotoxy(int x, int y)
{
    printf("%c[%d;%df",0x1B,y,x);
}

int main()
{
       gotoxy(10,10);
       printf("Hello World\n");

       return 0;
}

Categories: Uncategorized.

Comment Feed

3 Responses

  1. Great
    U have write a good program for gotoxy.
    can u tell me the about that line
    printf(“%c[%d;%df”,0×1B,y,x);
    Plz
    i m eagerly waiting ur reply.

    Thanks Dear

    Brain_fullMarch 6, 2007 @ 2:27 pm
  2. Its the way how you define ANSI codes. Refers to previous post link above to know more.



Some HTML is OK

or, reply to this post via trackback.

Continuing the Discussion

  1. [...] print text at any position without ncurses [...]