I still see no question in this post as you explain by yourself what you need to do. Do you just need confirmation? You just need the technique "Divide and Conquer".
1) First, write an application abc.exe accepting two parameters,
for function name,
for file name. Always validate parameters. First, validate that the user really supplied two parameters using
, than validate that a function and the file exists. How to validate that a function exists and select one? I'm afraid to say, by some long
statement. This is C++, and your whole idea is pretty bad, I must say, that's it. In this application, read the file. I hope you know how to read the file having its name. Write some other applications using the same schema for parameters, file type, etc.
2) Write the application xyz.exe accepting three parameters:
for child application executable name,
for function name,
for file name. Again, validate all parameters as I explained above. Additional validation is existing of the application passed as
3) Run the application passed as
, pass two other parameters as the parameters of child application. The parameters
in xyz.exe will become the values for parameters
in the child application. How to run it? It depends on your platform. For example, on Windows, this will be the call to Windows API
]; this is a simple code sample: http://goffconcepts.com/techarticles/development/cpp/createprocess.html
]. On other platforms, you will always find some API like
(like on Linux), "OS", etc.
Is that all clear? Perhaps I really don't understand what could cause any difficulties.
Now, I mentioned that this approach is pretty bad. Why torturing yourself with all that string values and validations and getting a lot of errors to handle, not even mentioning possible bugs? Better use DLLs or Shared Libraries (which is essentially the same).