It's possible I guess, but it's not the best way to do this. The best way is to use CreateProcess
. It's a more involved API, but it will make what you are attempting simpler.
The procedure goes like this:
- Create one or two pipes. You need one for the child's standard input. You need another if you wish to capture its output.
- Call
CreateProcess
to create the child. Attach the read end of the first pipe to the child's standard in. Attach the write end of the second pipe to the child's standard output.
- When you wish to send commands, write to the first pipe. When you wish to read output, read from the second pipe.
This can be daunting if you are not familiar with such coding. You might do well to find a library that makes it easy.
This MSDN article demonstrates how:
Creating a Child Process with Redirected Input and Output
Since you seem to be wanting to do FTP, you'd be better off avoiding an external process. Use a library such as Indy.