is there a way to clear screen?
Printable View
is there a way to clear screen?
Read the FAQs
Sevral. Based on your compiler.
There is an FAQ in this.
Borland uses clrscr()
Most go with system("cls") althougth the FAQ does say this is a lazy mans way to get the OS to do it for you.
Not to mention it's slow.
I don't find this technically clearing the screen, but it's in the FAQ...meh:Code:Write newline characters until everything has scrolled off of the screen:
#include <stdio.h>
#define SCREEN_HEIGHT 25
int main ( void )
{
int i;
for ( i = 0; i < SCREEN_HEIGHT; i++ )
putchar ( '\n' );
return 0;
}
I don't have clrscr() available, so I'll stick with system ("cls"). The other methods appear to be nothing more than convoluted attempts to complicate matters.
You don't have it because your compiler doesn't support it. I agree, the methods in the FAQ are...hmm...crap...not to mention confusing for beginners.
Take the advice from swgh, and use any of those two commands. They are probably the best ways to clear the screen. Remember KISS (Keep It Simple Stupid), even if it is "lazy", use what you got at hand.
are you using borland c++?