Sorry to be such a gimmy gimmy... but I couldn't find any threads on some code that clears the screen, just like DOS's 'CLS' and Bash's 'Clear'...I need a function that does the same thing as both CLS and Clear. Thanks for reading and or helping out.
Member #25180
Recommended Answers
Jump to Post— jeanatkin 0Hmm.... 'clrscr()' from 'conio.h' should serve your purpose
Jump to Post— jwenting 1,905You don't want to do that. It's considered rude in command line programs and in all others building up your own screen will replace what's underneath it anyway (at least while your application is running).
There's no platform independent way to achieve it btw (probably because of that) so …
Jump to Post— Narue 5,707>I need a function that does the same thing as both CLS and Clear.
#include <stdlib.h> #include "system.h" void clear() { #if defined(DOS_BASE) system("CLS"); #elif defined(UNIX_BASE) system("clear"); #else #error Unsupported system #endif }Will it work? Probably, provided you define either DOS_BASE or UNIX_BASE in system.h. Is …
Jump to Post— Narue 5,707Just to be sure that we are on the same page... the function should only clear the 'output' on the screen... not do anything with the actual program or command prompt. I want to create 'animation' in the command prompt, I have done this before with Batch files by echoing …
Jump to Post— Narue 5,707At least you can admit it. Kudos.
All 29 Replies
jeanatkin 0 Newbie Poster
jwenting 1,905 duckman Team Colleague
Narue 5,707 Bad Cop Team Colleague
Member #25180
Narue 5,707 Bad Cop Team Colleague
Member #25180
Narue commented: Merry Christmas -Narue +1
Narue 5,707 Bad Cop Team Colleague
Member #25180
jwenting 1,905 duckman Team Colleague
1o0oBhP 4 Posting Pro in Training
Member #25180
Narue 5,707 Bad Cop Team Colleague
Member #25180
Narue 5,707 Bad Cop Team Colleague
odee 0 Light Poster
Member #25180
1o0oBhP 4 Posting Pro in Training
odee 0 Light Poster
Member #25180
Dave Sinkula 2,398 long time no c Team Colleague
Member #25180
odee 0 Light Poster
Dave Sinkula 2,398 long time no c Team Colleague
Member #25180
odee 0 Light Poster
Dave Sinkula 2,398 long time no c Team Colleague
odee 0 Light Poster
Member #25180
Narue 5,707 Bad Cop Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.