Connecting Tech Pros Worldwide Forums | Help | Site Map

What does the system("cls") do?

Newbie
 
Join Date: Oct 2006
Posts: 3
#1: Oct 6 '06
I'm beginner at c++. I wanted to know what does the following code mean?

Expand|Select|Wrap|Line Numbers
  1. (system("cls");) 
thanks

Banfa's Avatar
AdministratorVoR
 
Join Date: Feb 2006
Location: South West UK
Posts: 6,195
#2: Oct 6 '06

re: What does the system("cls") do?


system()

is a call to the OS command line, "cls" is a command on some operating systems that clears the screen.

In my opinion use of the system() function should be avoided, it doesn't really add anything to the operation of the program that can't be done other ways or just shouldn't be done and does make the program very non-portable.
Member
 
Join Date: Sep 2006
Posts: 43
#3: Oct 6 '06

re: What does the system("cls") do?


Quote:

Originally Posted by PLISKIN

im beginner at c++ i wanted to know what does (system("cls");) means ??
thanks

system() is used to run the DOS commands from the C, C++.. cls is the clear screen command (DOS cmd)..
similarly you can use system("dir");

or

char s="cd bin";
system (cd);
Reply