| 6247 | |
| 6248 | #if CLEAR_WIN32_CONSOLE |
| 6249 | void clear_console() |
| 6250 | { |
| 6251 | //if (!IsDebuggerPresent()) |
| 6252 | // return; |
| 6253 | |
| 6254 | HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); |
| 6255 | CONSOLE_SCREEN_BUFFER_INFO csbi; |
| 6256 | DWORD consoleSize, charsWritten; |
| 6257 | COORD topLeft = { 0, 0 }; |
| 6258 | |
| 6259 | // Get console screen buffer info |
| 6260 | GetConsoleScreenBufferInfo(hConsole, &csbi); |
| 6261 | consoleSize = csbi.dwSize.X * csbi.dwSize.Y; |
| 6262 | |
| 6263 | // Fill the entire screen with spaces |
| 6264 | FillConsoleOutputCharacter(hConsole, ' ', consoleSize, topLeft, &charsWritten); |
| 6265 | |
| 6266 | // Set the cursor at the top left corner |
| 6267 | SetConsoleCursorPosition(hConsole, topLeft); |
| 6268 | } |
| 6269 | #endif |
| 6270 | |
| 6271 | //----------------------------------------------------------------------------------- |