how does GOTOXY work in dev c++......????????????????????
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2002-10-31
n9ne... How many forums have you asked the same question in?
You could also #include <conio.c> which is a work-a-round file written by Hongli Lai, tkorrovi, and Andrew Westcott. It is public domain and was included in Dev-Cpp 4.9.6.0, or maybe earlier.
Try this console app...
#include <conio.c> //Note the .c
int main(void)
{
gotoxy(10, 12);
printf("This should be at 10,12\n");
system("PAUSE");
return 0;
}
In this case, you can get away with just including <conio.c> because conio.c itself includes conio.h, stdio.h, stdlib.h, and windows.h. The non-debug executable is 5k.
To make a smaller executable, try this...
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
//Note that conio.c is *NOT* included.
int main(void)
{
//This is the actual gotoxy function from conio.c.
void gotoxy(int x, int y)
{
COORD c;
c.X = x - 1;
c.Y = y - 1;
SetConsoleCursorPosition (GetStdHandle(STD_OUTPUT_HANDLE), c);
}
gotoxy(10, 12);
printf("This should be at 10,12\n");
system("PAUSE");
return 0;
}
This console executable is 3k... you save 2k. (It would still be a bargin at twice the price. hehe.) Hope this helps.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
how does GOTOXY work in dev c++......????????????????????
n9ne... How many forums have you asked the same question in?
You could also #include <conio.c> which is a work-a-round file written by Hongli Lai, tkorrovi, and Andrew Westcott. It is public domain and was included in Dev-Cpp 4.9.6.0, or maybe earlier.
Try this console app...
#include <conio.c> //Note the .c
int main(void)
{
gotoxy(10, 12);
printf("This should be at 10,12\n");
system("PAUSE");
return 0;
}
In this case, you can get away with just including <conio.c> because conio.c itself includes conio.h, stdio.h, stdlib.h, and windows.h. The non-debug executable is 5k.
To make a smaller executable, try this...
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
//Note that conio.c is *NOT* included.
int main(void)
{
//This is the actual gotoxy function from conio.c.
void gotoxy(int x, int y)
{
COORD c;
c.X = x - 1;
c.Y = y - 1;
SetConsoleCursorPosition (GetStdHandle(STD_OUTPUT_HANDLE), c);
}
gotoxy(10, 12);
printf("This should be at 10,12\n");
system("PAUSE");
return 0;
}
This console executable is 3k... you save 2k. (It would still be a bargin at twice the price. hehe.) Hope this helps.