Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- void ClearScreen() {
- COORD topLeft = { 0, 0 };
- HANDLE hStdOut;
- DWORD written;
- CONSOLE_SCREEN_BUFFER_INFO screen;
- DWORD dwConSize;
- hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
- GetConsoleScreenBufferInfo(hStdOut, &screen);
- dwConSize = screen.dwSize.X * screen.dwSize.Y;
- FillConsoleOutputCharacter(
- hStdOut, (TCHAR)' ', dwConSize, topLeft, &written
- );
- FillConsoleOutputAttribute(
- hStdOut, screen.wAttributes, dwConSize, topLeft, &written
- );
- SetConsoleCursorPosition(hStdOut, topLeft);
- }
Add Comment
Please, Sign In to add comment