C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

C++

What is the keyword to clear the screen of console in C++ language.. And conio.h is not working. help

30th Oct 2017, 10:08 AM
Shivansh Maurya
Shivansh Maurya - avatar
4 Answers
+ 10
Hi Shivansh! conio.h is a non-standard header and is not supported here. There are various methods of clearing the console screen using standard c++ The easiest method is outputting blank space equal to the consoles buffer length. I have provided a link to a post which describes a few methods https://www.sololearn.com/discuss/316001/?ref=app
30th Oct 2017, 10:27 AM
jay
jay - avatar
+ 6
So very true.. Even with a max buffer size one would never see what was being cleared 😀 #logicfail #facepalm
30th Oct 2017, 10:58 AM
jay
jay - avatar
+ 5
Almost, clearing the screen is not possible in code playground, because of the way the in/output are handled: script run at server side (distant) and output is collected to be send back to user side (local) at once, when the script execution have finished... so, to support kind of clear screen we would need a way to clear the output buffer (only sololearn could decide to provide such feature, but it seems to me that it would be useless, as clearing the screen would have sense only in a realtime interactive display)...
30th Oct 2017, 10:55 AM
visph
visph - avatar
+ 3
For some clearing effect, you may print a large number of spaces, enough to move the scrollbar down. After all, this is what linux does when you type clear in the terminal.
30th Oct 2017, 1:23 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar