Replacement for system("cls")

May 21, 2013 at 2:18am
What is a replacement for system("cls")?
I want to clear the screen and start at back at the top of it.
p.s I'm afraid someone on this forum would stab me if i did use system("cls")

//i guess my code would go something like this...
#include <iostream>
using namespace std;

int main()
{
cout << "bla bla bla...";
system("cls"); // Oh no
cout << "This is printed at the top of the console. Yay.";
}
Last edited on May 21, 2013 at 2:19am
May 21, 2013 at 2:51am
well depends how many lines you want to clear. Technically if it is only one line at a time you can use '\r'
otherwise you will have to move the cursor and then use '\r' on each line
There could be other more efficient ways though.
May 21, 2013 at 3:24am
Topic archived. No new replies allowed.