Menu

GOTOXY ...why doesn't it work?

Anonymous
2002-10-27
2012-09-26
  • Anonymous

    Anonymous - 2002-10-27

    how does GOTOXY work in dev c++......????????????????????

     
    • Anonymous

      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.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.