Reputation: 494
I have an open source C++ command line application (written in MS VC2008 for Windows OS) that I almost completely understand. It's basically a wrapper for an audio encoding DLL that parses its arguments (argc, argv[])
into a "parameters" struct (of int, bool, and char* types), and then passes this struct to the DLL. I'm a beginner in C/C++ and I need some help in modifying the source code to do the following:
1) Constructing a string (char* or some String class) from the parsed original args. For example, construct a "0 128 3 1 0 InFile OutFile" string respectively from:
int a = 0, b = 128, c = 3;
bool x = true, y = false;
char * in = "InFile", out = "OutFile";
2) Run another existing command line executable with the constructed string as its argument line, and hold execution of the initial application until the shelled program finishes and exits.
I'm not sure how simple (or not) this is, but I have no idea on how to go about this. I only need this for my personal use, and I could do it in the blink of an eye in VB, but as I said, no idea in C++.
Upvotes: 0
Views: 175
Reputation: 171263
Look into the GetCommandLine and Createprocess functions, as well as possibly CommandLineToArgvW function
Upvotes: 1