# Is there a faster way to clear the screen?

I'm currently clearing my console window with this piece of code:

void clrScr()
{
COORD cMap =
{
0, 3
};
if(!FillConsoleOutputAttribute(hCon, 0, 2030, cMap, &count))
{
std::cout << "Error clearing the console screen." << std::endl;
std::cout << "Error code: " << GetLastError() << std::endl;
std::cin.get();
}
}


, which I call once in the main loop.
But since my window is quite large (70x35), it's flickering quite a bit.

I was wondering if there are any faster methods of doing this?

-
Have a look at ncurses for a platform neutral techniques for clearing a console window. –  Loki Astari Dec 4 '12 at 7:33
Not really looking for a new lib. Thanks anyways. –  user19953 Dec 4 '12 at 9:57
You should be looking for a new lib. You are using standard IO for stuff which it wasn't meant to be used for. –  Winston Ewert Dec 5 '12 at 21:27

Have a look at Clear the Screen. It basically boils down to using what you did (since the Windows console doesn't accept standard ansi sequences), although you might try the conio.h route.

-
I can't use clrscr() for some reason. Probably something to do with the fact that it's non-standard. And pretty much the only other way (without using external libs) would be the way I'm doing it.. It seems there are no better ways of doing this, so I won't accept an answer, at least for now. If there are no better answers after a while, I'll accept yours. –  user19953 Dec 5 '12 at 23:09

system("cls");