1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#ifdef _WIN32
#include <windows.h>
bool gotoxy( int column, int line )
{
COORD coord = { column, line };
return SetConsoleCursorPosition(
GetStdHandle( STD_OUTPUT_HANDLE ),
coord
);
}
#else
#include <term.h>
#include <unistd.h>
bool gotoxy( int column, int line )
{
if (!cur_term)
{
int result;
setupterm( NULL, STDOUT_FILENO, &result );
if (result <= 0)
return false;
}
putp( tparm( tigetstr( "cup" ), line, column, 0, 0, 0, 0, 0, 0, 0 ) );
return true;
}
#endif
|