I have use a function of <windows.h> library. And I have met error with MS Visual Studio 2010, but when I compiled on Dev-C++, No problem. Here my code:
Code:
void gotoXY(int x, int y)
{
COORD coor;
coor.X=x;
coor.Y=y;
int a =coor.X;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coor);
}
void clearLine(int line)
{
COORD coor;
int x=coor.X;
int y=coor.Y; //Error in this line: VS 2010 . but no problem in Dev-C++
gotoXY(0,line);
for(int i=0;i<50;i++) std::cout<<" ";
gotoXY(x,y); //back to the past cursor
}
int main ()
{
gotoXY(3,4);
clearLine(0);
getch();
return 0;
}
when I compile, VS tak error:
the vaialbe 'coor' is being used without being initalized
who know this problem, tell to me,please.
thanks