开发者

How can I use and launch an exe file inside my c++ program?

开发者 https://www.devze.com 2023-03-27 06:54 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消