Amirhessam
Amirhessam

Reputation: 154

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.

Upvotes: 0

Views: 1055

Answers (4)

leftysanboy
leftysanboy

Reputation: 11

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

Upvotes: 0

Blazes
Blazes

Reputation: 4779

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

Upvotes: 2

love_me_some_linux
love_me_some_linux

Reputation: 2741

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.

Upvotes: -1

Mike Kwan
Mike Kwan

Reputation: 24447

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

Upvotes: 4

Related Questions