简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM