How to update console without flicker in c++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

How to update console without flicker in c++?

I wrote a game program in c++ and i used system("cls") command to clear the screen amd update the console. But the system("cls") seems to be too slow and there is too much flicker. So is there an alternative to system("cls") command.

7th Mar 2019, 4:26 AM
Lord Thanatos
Lord Thanatos - avatar
2 Answers
+ 9
void ClearScreen() { COORD cursorPosition; cursorPosition.X = 0; cursorPosition.Y = 0; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), cursorPosition); } Use this and #include <windows.h>
7th Mar 2019, 4:47 AM
B K
+ 3
B K thank you, the flickering stopped.
7th Mar 2019, 5:41 AM
Lord Thanatos
Lord Thanatos - avatar