system, calling a program

So I know that I can call a program by system("prog.exe"), but what do I add in when I want to pass a parameter?
1
2
3
4
5
6
7
8
void doCmd(const string &par1, const string &par2)
{
    const string exampleCommand = "prog.exe" + " " + par1 + " " + par2;

    const int exitCode = system(command.c_str());

    // ...
}
The string that you pass into system should be exactly what you would type on the command line to run the program, including any CLA that you would type.
Topic archived. No new replies allowed.