Link to home
Start Free TrialLog in
Avatar of ardolino
ardolino

asked on

Redirecting Console Application Stdin/out

I would like to be able to spawn from a Windows application a console application (such as ftp) and redirect the standard input and output.  In particular, I would like to be able to take the standard output/error and send it to a text box on the screen instead of appearing in a DOS window.  Microsoft's developer studio does this when it compiles code.  How do I do this?  I believe it has something to do with CreateProcess and the handles you can specify in the STARTUPINFO structure, but I don't know which handles to specify or how to link them to a text box in my windows application.
Avatar of chensu
chensu
Flag of Canada image

HOWTO: Spawn Console Processes with Redirected Standard Handles
http://support.microsoft.com/support/kb/articles/q190/3/51.asp

INFO: Redirection Issues on Windows 95 MS-DOS Applications
http://support.microsoft.com/support/kb/articles/Q150/9/56.ASP
Avatar of ardolino
ardolino

ASKER

These articles are helpful, but only answer half of my question.  I need to know how to take the information that is coming in/going out from the child's process standard handles and send it to/from a text box in a windows application.
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This really isn't what I wanted, but it was sort of helpful.
I cut an pasted this code into my :
void CDialitDlg::OnDialButton()
function and did a build all (VC++ v4)
and got this error:

error C2599: 'StartCommandLine' : local functions are not supported

I am sure it is a basic error - I am a
new programmer.  Any help in fixing this?