Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have a question about system function.
system(const char *);

For example:
system("cls");    //clear monitor

Can anyone explain the meaning of the argument for this function?

thanks.
Posted
Updated 26-Apr-11 2:40am
v3
Comments
Sandeep Mewara 26-Apr-11 5:24am    
Not clear...
Olivier Levrey 26-Apr-11 8:41am    
Edited for clarity.

The argument of this function is what you would write in a Console. The full list or available commands can be found there:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx?mfr=true[^]
Or
http://commandwindows.com/command3.htm[^]
 
Share this answer
 
Comments
Nish Nishant 26-Apr-11 8:45am    
Voted 5!
As Olivier points out the argument is what you would write on the console to run the command.

You can launch apps and other things using that instruction.

The "problem" is that it has been deprecated and that it is highly recommended to use the CreateProcess[^] function now...

Good luck...
 
Share this answer
 
Comments
Nish Nishant 26-Apr-11 8:45am    
Voted 5!
Joan M 26-Apr-11 9:30am    
Thank you Nish!
[Led Mike tone] It is well hidden inside the documentation [/Led Mike tone]: system[^].
 
Share this answer
 
Not necessarily write to console. It would call CreateProcess, using reserved-fields of STARTUPINFO.
system function is nothing but simplified call for CreateProcess. It can, however, handle internal command.com/cmd.exe commands like 'cls', 'type' etc.
 
Share this answer
 
int system ( const char * command );
this is the argument for system().
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900