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.

Geek-Master
Recommended Answers
Jump to Post>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 PostJust 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 Postdid you include conio.h?
when I use clrscr(); it gives me a linker error that it's undefined. Could this be an issue with my library? I'm using Dev-C++ 4.
Am I supposed to alter the header file, I guess to define it?
For those that aren't aware, the linker does …
Jump to Posthttp://www.bloodshed.net/faq.html#12
[edit]Oops. [Read before posting, Dave.]
Jump to Postif you want to clear the screen try this one:
#include<stdlib.h>
int main() {
system("cls");
return 0;
}::smacks forehead::
Narue: leave bruises.
All 29 Replies
jeanatkin 0 Newbie Poster
jwenting 1,905 duckman Team Colleague
Narue 5,707 Bad Cop Team Colleague

Geek-Master
Narue 5,707 Bad Cop Team Colleague

Geek-Master
Narue commented: Merry Christmas -Narue +1
Narue 5,707 Bad Cop Team Colleague

Geek-Master
jwenting 1,905 duckman Team Colleague
1o0oBhP 4 Posting Pro in Training

Geek-Master
Narue 5,707 Bad Cop Team Colleague

Geek-Master
Narue 5,707 Bad Cop Team Colleague
odee 0 Light Poster

Geek-Master
1o0oBhP 4 Posting Pro in Training
odee 0 Light Poster

Geek-Master
Dave Sinkula 2,398 long time no c Team Colleague

Geek-Master
odee 0 Light Poster
Dave Sinkula 2,398 long time no c Team Colleague

Geek-Master
odee 0 Light Poster
Dave Sinkula 2,398 long time no c Team Colleague
odee 0 Light Poster

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