It's pretty old, but it should still work. Switching to assembly language is left as an exercise for the reader, but should not be terribly difficult (most of them are just function calls, and multiplication is trivial):
#include <windows.h> void clear_screen(char fill = ' ') { COORD tl = {0,0}; CONSOLE_SCREEN_BUFFER_INFO s; HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE); GetConsoleScreenBufferInfo(console, &s); DWORD written, cells = s.dwSize.X * s.dwSize.Y; FillConsoleOutputCharacter(console, fill, cells, tl, &written); FillConsoleOutputAttribute(console, s.wAttributes, cells, tl, &written); SetConsoleCursorPosition(console, tl); }
Jerry Coffin May 03 '11 at 7:53 a.m. 2011-05-03 07:53
source share