| | |
I Summon Clear Screen
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
You 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 if you insist you'll have to plow through your compiler documentation to see if there's a function for it and how to call it.
You could of course always figure out the memory location of your screenbuffer and manually poke zeros into each position and hope.
There's no platform independent way to achieve it btw (probably because of that) so if you insist you'll have to plow through your compiler documentation to see if there's a function for it and how to call it.
You could of course always figure out the memory location of your screenbuffer and manually poke zeros into each position and hope.
>I need a function that does the same thing as both CLS and Clear.
Will it work? Probably, provided you define either DOS_BASE or UNIX_BASE in system.h. Is it advisable? No, not really. But I've described why elsewhere, and it's really your decision.
C++ Syntax (Toggle Plain Text)
#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 }
I'm here to prove you wrong.
Just 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 text and then 'cls' and echoing the text in another spot on the line. I want to be able to do the same, by just clearing whats on there and then creating the illusion of animation.
•
•
•
•
Originally Posted by Geek-Master
Just 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 text and then 'cls' and echoing the text in another spot on the line. I want to be able to do the same, by just clearing whats on there and then creating the illusion of animation.
I'm here to prove you wrong.
![]() |
Other Threads in the C++ Forum
- Previous Thread: Possible alternatives?
- Next Thread: Compile and linking problems with Microsoft Visual C++
| Thread Tools | Search this Thread |
api application array arrays based beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg simple sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






