C Language Development Kit/Functions/GotoXY

From OptiWiki

Jump to: navigation, search
Description This function moves the cursor position to a new location.
Syntax
void gotoxy(int x, int y);
Arguments
int x, int y
The arguments x and y specify the new position of the cursor on the display.
Returns None
Remarks gotoxy() uses character coordinates. This means that gotoxy(0,1) places the cursor underneath the first character on the second line. Since the size of a character depends on the selected font, the exact physical location of the cursor after a call to gotoxy() is dependent on the font type in use.

The character coordinates of the upper left corner are (0,0). The character coordinates of the bottom right corner when using a system font is:

Terminal Large font Small font Medium font Tiny font
OPH100x 13,7 13,15 17,9 17,20
PHL1300 15,3 or 15,4 15,7 or 15,9
PHL1700 15,3 15,7
PHL2700 15,3 15,7 20,4 20,9
DWT7133 15,1
OPL97xx 13,3 13,7 17,4 17,9
DCL153x 13,3 13,7 17,4 17,9

Note: with the PHL1300 it depends on cursor() with the ICONS/NOICONS option what the actual screen size will be.

The PHL terminals can be placed in a special mode in which gotoxy() will assume that there are 8 lines, regardless of the selected font. This mode is for compatibility with older models handheld terminals. This mode can be switched on and off by a call to systemsetting().

Example
#include "lib.h"
#include <stdio.h>
 
void main( void )
{
    printf("\f");
    gotoxy(0,1);
    printf("Second line");
    while( 1 )
        idle();
}


Views
Personal tools