I want to use an .exe file inside my c++ program. I reviewed and 开发者_运维问答checked these functions (system - ShellExecute - CreateProcess) to achieve this goal, but I found them useless because I need the output of that .exe file inside my program for further processes.
CreateProcess can be used to pipe the output from the created program back to the creator. MSDN even has sample code to do exactly this: Creating a Child Process with Redirected Input and Output
I think you do want CreatProcess
. You can get the STDIN / STDOUT:
http://msdn.microsoft.com/en-us/library/ms682499%28v=vs.85%29.aspx
you should use the "Process.standardOutput" to read the result of an .exe.
Here is the link on MSDN, there is plenty of explainations:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standardoutput(v=vs.71).aspx
You could use one of those functions to execute your file and have it write the output to another file. Then you just have to read that into your program.
精彩评论