Computing.Net > Forums > Programming > C Clear screen?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

C Clear screen?

Reply to Message Icon

Name: Blasterman
Date: November 20, 2007 at 19:06:52 Pacific
OS: Check my sig.
CPU/Ram: More than one computer th
Product: More than one computer th
Comment:

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.



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: November 21, 2007 at 00:29:34 Pacific
Reply:

I do believe it's OS dependent. Sorry.


0

Response Number 2
Name: IVO
Date: November 21, 2007 at 04:32:04 Pacific
Reply:

You may try (#include <stdlib.h>)

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

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


0

Response Number 3
Name: Razor2.3
Date: November 21, 2007 at 04:55:03 Pacific
Reply:

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.


0

Response Number 4
Name: cup
Date: November 26, 2007 at 12:34:28 Pacific
Reply:

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...


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


im stuck:( in C++ Batch pipe character prob...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: C Clear screen?

c++ clear screen www.computing.net/answers/programming/c-clear-screen/7675.html

clear screen in visual C++ www.computing.net/answers/programming/clear-screen-in-visual-c/1919.html

help needed in clear screen! www.computing.net/answers/programming/help-needed-in-clear-screen/12748.html