PDA

View Full Version : Clearing the sCreen in C.


David
09-07-01, 01:53 PM
?
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");
}
}

_jubei_
09-07-01, 06:21 PM
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

Alun
09-07-01, 08:35 PM
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...:o

phendish
09-07-01, 11:05 PM
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).

David
09-08-01, 05:02 AM
Thanks very much. I'm using command line linux (about the same as CLI UNIX).

I'll PM EngJohn sometime