• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Clearing the sCreen in C.

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

David

Forums Super Moderator
Joined
Feb 20, 2001
?
Is there a function?

I have previously used one of my own, a bit crude tho':

void
clearscreen(void)
{
int i;
for ( i=0;
i<100;
++i)
{
printf("\n");
}
}
 
If you are programming in windows, then there is a function that clears the screen. But if you program in DOS then I think this is the best way to do it
 
I don't have any programming books at the moment... but I know that there is a much better way than this in DOS (and thus probably similar in unix). It uses a BIOS call...

union REGS regs;

reg.h.al=0x00;
blah blah blah that I can't remember

int86(something,something,something);

Sorry... It's a bit vague... I'll look it up and make a proper reply next weekend. Meanwhile, try searching the net for int86 and REGS.


This method is SIGNIFICATLY faster than the one you gave... If only I could remember what it was...:eek:
 
EngJohn would be the best person to talk to on this matter - he helped me greatly with the very same problem.

It runs to the effect of adding the line: system ("cls") into the code, but I'm not sure if that's all. It seems like there's more

I'll dig around and try to find the info that he gave me, if I still have it. (which I hope I do).
 
Thanks very much. I'm using command line linux (about the same as CLI UNIX).

I'll PM EngJohn sometime
 
Back