Code: Select all
// Draws a box at position (x, y) with width w and height h.
void drawBox(int x, int y, int w, int h) {
int i;
gotoxy(x, y);
putchar(150);
for (i = 1; i < w - 1; i++) {
putchar(154);
}
putchar(156);
for (i = y + 1; i < y + h - 1; i++) {
gotoxy(x, i); putchar(149);
gotoxy(x + w - 1, i); putchar(149);
}
gotoxy(x, y + h - 1);
putchar(147);
for (i = 1; i < w - 1; i++) {
putchar(154);
}
putchar(153);
}
It seems as if the gotoxy commands were completely ignored.
Then I wrote my own gotoxy function:
Code: Select all
void gotoxy(unsigned int x, unsigned int y) {
putchar(27); // ESC
putchar('Y'); // cursor to position
putchar(y + 32); // row + 32
putchar(x + 32); // column + 32
}
So - what's wrong with the conio.h version of gotoxy?