#ifndef _CONSOLE_HPP_20040918_ #define _CONSOLE_HPP_20040918_ /** * Console cleaning routine. * * Saulius V. * 2004, September. */ #ifdef __WIN32__ #include #endif /** * Clears the screen. */ void clrscr() { // The function works only in windows :( #ifdef __WIN32__ // Get the screen. HANDLE hCout = GetStdHandle(STD_OUTPUT_HANDLE); COORD c = { 0, 0 }; DWORD len; // Clear it. FillConsoleOutputAttribute(hCout, 14 | 0, 100000, c, &len); FillConsoleOutputCharacter(hCout, ' ', len, c, &len); // Goto (0; 0) SetConsoleCursorPosition(hCout, c); #endif } #endif // _CONSOLE_HPP_20040918_