Header Ads

Gotoxy in Dev c++

Using gotoxy funxtion is quiet difficult in devc++ because there is no such header file present in dev c++ to use gotoxy function. What we have to all do is that we have to create the function for positioning cursor in devc++

I am showing you here a simple example for using gotoxy function :

#include<stdio.h>
#include<conio.h>
#include<windows.h>
void gotoxy(short x, short y); //here we declare the gotoxy function//
main()
{
gotoxy(30,16); //now where we want to call gotoxy function //
printf("Hi i am,here");
return 0;
}
void gotoxy(short x, short y) //definition of gotoxy function//
{
COORD pos ={x,y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}

Note that gotoxy is function name here i.e. you are able to change that it may be anything except keywords

6 comments:

  1. thanks. it does work!

    ReplyDelete
  2. thank u it's working

    ReplyDelete
  3. Thank you so much,i'm really happy..

    ReplyDelete
  4. It doesn't work for Android? I hope have on androAn user, I don't have a laptop or PC just Android:-(

    ReplyDelete