Command Prompt for Windows




gotoxy

void gotoxy(int x, int y);

Position the caret on the screen point x, y.

Parameter Description
x Co-ordinate on the horizontal x-axis.
y Co-ordinate on the vertical y-axis.

Returns

There is no return value

Comments

The first character on the screen is at co-ordinate 1, 1.

See Also

wherex, wherey

Example

#include "woio.h"
#include <string.h>

/* 
   Display the string "Hello, World" 
   centred on the screen 
*/

int main(void)
{
    char *s;

    s = "Hello, World";   /* string to display */
    clrscr();

    gotoxy((scrwidth() - strlen(s)) / 2, scrheight() / 2);
    textcolor(COL_HIGHTEXT);
	printf("%s", s);

    gotoxy(0, scrheight());

    return 0;       /* error level */
}