Click to See Complete Forum and Search --> : C++ Clear Screen Question


berb
11-10-2000, 05:38 AM
I ripped this off a prior post:

// Clears the screen and moves cursor
void clrscr(void)
{
cout<<"\033[2J";
cout<<"\033[0;0f";
}

But do not UNDERSTAND it, and would like too.

thanks
(C++ and Linux Newbie)



------------------
I've got a special dispensation from original sin.

binaryDigit
11-10-2000, 12:10 PM
those are the ansi escape sequences.

cout << "\033[2J";

\033 is the escape key , [2J clears the screen.

to find out more do a search on google for the ansi escape sequences.

you can clear the screen, change text color and intensity, etc.


------------------
http://home.earthlink.net/~pebice/philLinux.html (http://home.earthlink.net/~pebice)

tminos
11-10-2000, 12:23 PM
On some systems you could also use

system("clear");

but I would say what you have now is cleaner.