How do I set up a clear screen function

Aug 16, 2014 at 6:52am
void clear()
{
//code


}


And what library should I include?
Please not the spamming spaces method , I want to clear the console properly, thx
Aug 16, 2014 at 7:07am
There are no real ways of clearing the console properly, at least for standard C++. If you want to do it 'properly', you'll need to either use the native API for your operating system or a curses-like library.

A good article to read is this one: http://www.cplusplus.com/articles/4z18T05o/
Aug 17, 2014 at 2:04pm
what about system(CLEAR) or system(CLS) i forgot...which one
Aug 17, 2014 at 3:51pm
Preferably neither, and you got it wrong anyway (you forgot it takes a string literal). There are many reasons why system is bad - really the only thing it should be used for are throw-away little scripts you are writing, though C++ isn't the optimal language for that kind of thing.
Last edited on Aug 17, 2014 at 3:51pm
Topic archived. No new replies allowed.