5
Contributors
6
Replies
9
Views
10 Years
Discussion Span
Last Post by karrl
0

Please read this thread. posted a couple days ago

gotoxy is a borland-specific function which was never implemented by any other compiler. If you want to use it with other compilers you will have to write your own gotoxy() function using operating system specific api calls.

0

if you are using visual C++ it is very simple to write your own functions.

// function definition -- requires windows.h

void gotoxy(int x, int y)
{
HANDLE hConsoleOutput;
COORD dwCursorPosition;
cout.flush();
dwCursorPosition.X = x;
dwCursorPosition.Y = y;
hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hConsoleOutput,dwCursorPosition);
}

// function definition -- requires process.h
void clrscr()
{
system("cls");
}

0

>// function definition -- requires process.h
The only header needed for that function is <cstdlib>.

0

in DEV C++


#include <windows.h>

void gotoxy(int x, int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_H ANDLE), coord);
}

the clrscr function should work

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.