How do you run an executable with parameters passed on it from a C++ program and how do you get the return value from it?
Something like this: c:\myprogram.exe -v
How do you run an executable with parameters passed on it from a C++ program and how do you get the return value from it?
Something like this: c:\myprogram.exe -v
Portable way:
int retCode = system("prog.exe arg1 arg2 arg3");
With embedded quotes/spaces:
int retCode = system("prog.exe \"arg 1\" arg2 arg3");
On Windows, if you want a bit more control over the process, you can use CreateProcess to spawn the process, WaitForSingleObject to wait for it to exit, and GetExitCodeProcess to get the return code.
This technique allows you to control the child process's input and output, its environment, and a few other bits and pieces about how it runs.