C Clear screen?

More than one computer th
November 20, 2007 at 19:06:52
Specs: Check my sig., More than one computer th
Is there a universal terminal clear function in C? I'm using Windows XP, but I need this function to work with *nix systems as well.

All the OSes I use:
Windows XP, Windows 98, MS-DOS 6.22, OpenBSD 2.6, DLX Linux. I have 4 computers, one of which is emulated.

See More: C Clear screen?

Report •

November 21, 2007 at 00:29:34
I do believe it's OS dependent. Sorry.

Report •

November 21, 2007 at 04:32:04
You may try (#include <stdlib.h>)

if (system("cls")) system("clear");

That works under Win/DOS (either 9X/NT) and Linux/Unix.

Report •

November 21, 2007 at 04:55:03
Well, I'd use 'tput clear' (it's been around longer, I think) for the *nix, but yeah, that might be the best way to do it.

Report •

Related Solutions

November 26, 2007 at 12:34:28
Unix - if it is an ANSI terminal, \033[2J will clear the screen.

On Windows 9x/ME, if ANSI.sys is loaded, \033[2J will work.

On Windows NT/2K/XP, have a look at http://msdn2.microsoft.com/en-us/li...

Report •

Ask Question