944,156 Members | Top Members by Rank

Ad:
  • C++ Code Snippet
  • Views: 67864
  • C++ RSS
0

clear screen

by on Jan 29th, 2005
A simple demostration of how to clear the console screen in at least Dev-C++ 4.9.8.0 (I don't know about the other since I've only tried it on this one, but may and probably works,, with few if at all minor adjustments), what more can I say, other than it's not the best way to do it but may be useful.
C++ Code Snippet (Toggle Plain Text)
  1. #include <iostream>//needs these three lines
  2. #include <stdlib.h>//needs these three lines
  3. using namespace std;//needs these three lines
  4.  
  5. int main(int argc, char *argv[])
  6. {
  7. cout << "A simple Demonstartion of system(\"cls\");" << endl;
  8. system("PAUSE");
  9. system("cls");//clears the screen
  10. cout << "The first two lines are gone" << endl;
  11. system("PAUSE");
  12. return 0;
  13. }
Comments on this Code Snippet
Feb 2nd, 2005
0

Re: clear screen

i modified it a little bit for c and it works , i learned one thing today , thanx
Newbie Poster
nico is offline Offline
16 posts
since Nov 2004
Feb 3rd, 2005
0

Re: clear screen

Than it's mission has been fulfilled
Junior Poster in Training
eagleeye is offline Offline
87 posts
since Dec 2004
Feb 4th, 2005
0

Re: clear screen

hmm. wonder if that works for visual c++
Newbie Poster
bombe is offline Offline
14 posts
since Feb 2005
Feb 4th, 2005
0

Re: clear screen

hmm. wonder if that works for visual c++
Newbie Poster
bombe is offline Offline
14 posts
since Feb 2005
Feb 4th, 2005
0

Re: clear screen

i just tried it on codewarrior C++ and it didn't work ;/
Newbie Poster
bombe is offline Offline
14 posts
since Feb 2005
Feb 10th, 2005
0

Re: clear screen

Sorry about that, but that's the only thing I could find on how to clear the screen, and so far I could get to work only on Dev-C++
Junior Poster in Training
eagleeye is offline Offline
87 posts
since Dec 2004
Mar 23rd, 2005
0

Re: clear screen

the code should be ANSI standard code to work on all compilers, and i DONT see any un-ANSI code! it should work on others, i have compiled DevC++ projects on MSVC++ Before without any problems
Posting Pro in Training
1o0oBhP is offline Offline
445 posts
since Dec 2004
Mar 23rd, 2005
0

Re: clear screen

try substituting <cstdlib> in place of <stdlib.h>
Posting Pro in Training
1o0oBhP is offline Offline
445 posts
since Dec 2004
Mar 27th, 2005
0

Re: clear screen

haven't tried this, but it should work on linux if you replace cls with clear
Newbie Poster
dave2point0 is offline Offline
6 posts
since Mar 2005
Message:
Previous Thread in C++ Forum Timeline: Need Help with this program:PLz Help
Next Thread in C++ Forum Timeline: scanf reacts strangly





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC