This page has been designed specifically for the printed screen. It may look different than the page you were viewing on the web.
Please recycle it when you're done reading.

The URI for this page is { http://cc.byexamples.com }

print text at any position without ncurses Posted on January 21st

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;
}
Trackback URL

Some Responses to “print text at any position without ncurses” :

  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

    Commented Brain_full on March 6th, 2007.
  2. Its the way how you define ANSI codes. Refers to previous post link above to know more.

    Commented mysurface on March 7th, 2007.
  3. [...] print text at any position without ncurses [...]

    Commented writting a fun cli apps with ncurses on March 30th, 2007.
Leave your own comments about this post: