Click to See Complete Forum and Search --> : Clear screen


sandeep1
May 3rd, 1999, 08:49 PM
Hi,
I am writing a OOP program which create menu using cout. I am not using MFC or
graphic programming. Just simple standard OOP C++ language. Once I select option# from my menu, it will create sub-menu. But the problem is I want to clear the screen from standard output and then sub-menu should written to standard output. I tried but I could not find a key which will clear the standard output. Any suggestions?

Thanks,

Sandeep

Dave Lorde
May 4th, 1999, 09:17 AM
For a quick screen clear, you could output sufficient new lines to scroll any text off the console window...

Otherwise, have a look at the Console Functions such as
ScrollConsoleScreenBuffer, FillConsoleOutputCharacter, etc.

Dave

chiuyan
May 4th, 1999, 10:14 AM
for a normal console app, you can use

System ("cls");

--michael

Jason Brooks
May 4th, 1999, 12:40 PM
The Alternative which is better than A System Command or Outputting lines is to use old fashioned Escape characters like 27 73

May 4th, 1999, 01:19 PM
Another easy way is :

int main()
{
cout << "the command bellow gonna clear the screen, let's try this...";
cout << "\x1b[2J"; // CLEAR SCREEN

// You need to path ansi.sys into your config.sys (and the \x1b[2J gonna do job
}