C++ Win32 Console Tutorial 10 - System Programming and Commands



Up to this point, we have used system(“PAUSE”) to pause the computer, but we have not gone over what system() is. system() sends commands to the operating system.

Open the command prompt, and type pause. The computer will pause the same way as when we used system(“PAUSE”). Because Windows is not case sensitive, system(“pause”) will work too. In the command prompt, type calc and the calculator will run. To run the calculation within your c++ code, use system(“calc”). Escape sequences must be used when using the back slash and quotes within system().

For example, to make a directory, on the desktop called Tutorial10, the command could be

system(“md c:\\users\\admin\\desktop\\Tutorial10”);

Your computer may have a different path to your desktop.

Notepad, Calculator, and Internet Explorer are used as an example of running programs from your C++ application.

Code Download
CPPW32T10.zip