Click to See Complete Forum and Search --> : How do you clear the screen on C++?


beginner_c++
April 11th, 2004, 10:43 AM
Hi, how do you clear the screen on C++? on VB you used cls to clear the screen, but I don't know what function to use thanks for the help.

cup
April 13th, 2004, 03:22 AM
Have a look at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/clearing_the_screen.asp

Techniques are a bit naff. Alternatively, if you have ansi.sys loaded, just print

"\033[2J"

vcstarter
April 14th, 2004, 01:51 PM
You can try

#include <conio.h>

and

call the function

clrscr();

Paul McKenzie
April 14th, 2004, 01:57 PM
Originally posted by beginner_c++
Hi, how do you clear the screen on C++? on VB you used cls to clear the screen, but I don't know what function to use thanks for the help. First, there is no function in standard C++ to clear the screen.

There may be functions that are specific to your operating system that clear the screen. Again, it all depends on the OS that you are running (and compiler brand counts also -- one compiler may call the function cls(), while another may call it clrscr(), while another may call it ClearTheScreen()).

Regards,

Paul McKenzie

Paul McKenzie
April 14th, 2004, 01:58 PM
Originally posted by vcstarter
You can try

#include <conio.h>

and

call the function

clrscr(); If the OP is running anything other than Visual C++, this may not even compile, let alone run.

Regards,

Paul McKenzie

kasracer
April 14th, 2004, 02:03 PM
<cstdlib>

system("cls");