0

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++.

1 Answer 1

1

Look into the GetCommandLine and Createprocess functions, as well as possibly CommandLineToArgvW function

Sign up to request clarification or add additional context in comments.

2 Comments

These look promising. Will look into them.
CreateProcess and WaitForSingleObject were what I was looking for. Didn't need GetCommandLine() in my case since original code was written C-style (i.e. argc and argv passed to main(), so already had access to the original command line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.