20101030

_clrscr() (prg05)

#language :: c/c++ (mingw)
#purpose :: winapi clrscr implement
#date :: 30102010
#author :: gerganov

void _clrscr(void)
{
         COORD coordScreen = {0,0}; // upper left corner
         DWORD cCharsWritten;
         DWORD dwConSize;
         HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE);
         CONSOLE_SCREEN_BUFFER_INFO csbi;
         GetConsoleScreenBufferInfo(hCon, &csbi);
         dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
         // fill with spaces
         FillConsoleOutputCharacter(hCon, TEXT(' '), dwConSize, coordScreen, &cCharsWritten);
         GetConsoleScreenBufferInfo(hCon, &csbi);
         FillConsoleOutputAttribute(hCon, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
         // cursor to upper left corner
         SetConsoleCursorPosition(hCon, coordScreen);
}

#searchterms :: winapi clrscr implement, FillConsoleOutputCharacter clrscr, _clrscr(), clrscr(), clear screen, cls implement, clear screen winapi, winapi clrscr, conio.h clrscr, winapi conio.h

20101025