Thursday, July 30, 2009

Where can I find the complete list of commands for system() function in C?

I need to know the complete list of commands for system() function from stdlib.h in C or C++...





Example: The "cls" command...





system("cls") command clears the screen...





I bet there are other commands available for system() function... Please help... Thanks! (^^,)

Where can I find the complete list of commands for system() function in C?
most of the system commands are present in "C:\Windows" or "C:\Windows\System32" or "C:\Windows\System"


Check it out. There are more than 400 commands as for as I know :)





NOTE: If you want to try check the MSDN/Windows help and try to execute. There are lot of chances for when executing the commands with wrong / incorrect parameters will change the system settings which may lead to abnormal behaviour of system.





I executed some command for time pass and finally ended up in reinstalling Windows :) :) So take care before you play around
Reply:system() is used to run the DOS commands from the C, C++. environment. Basically you are invoking the DOS shell and you can run any shell command. (Ping, ipconfig, etc.)








The use of system is often advised against if there is another solution. The reason for this is that you do not always know if the program you are calling exists. For example, if you type





system("notepad")





your program will not work properly if Notepad has been deleted, or if you are using an operating system other than Windows.





The use of system is not 'forbidden', but keep this in mind when programming, and try, whenever practical, to use a more portable and safe solution.


No comments:

Post a Comment