I'm using the following code
System::Diagnostics::Process^ p = gcnew System::Diagnostics::Process();
p->StartInfo->FileName = "tnccmd.exe";
p->StartInfo->UseShellExecute = false;
p->StartInfo->RedirectStandardInput = true;
p->StartInfo->RedirectStandardOutput = true;
p->Start();
System::IO::StreamWriter^ tnc_stdin = p->StandardInput;
System::IO::StreamReader^ tnc_stdout = p->StandardOutput;
tnc_stdin->WriteLine("connect i 127.0.0.1");
String^ prg_output = tnc_stdout->ReadToEnd();
My problem is that I cannot read stdout correctly. I can easily write to stdin however, but now I'm trying to implement some error checking code and it doesn't work.
The program I'm using doesn't seem to write to stdout even if it is made to run in command line. I can reproduce the bug with ftp.exe which comes with Windows XP by default. If you change the ->FileName with ftp.exe the command prompt ftp.exe usually gives ftp> will not show up in prg_output.
Now I know that the prompt must use some kind of windows shell curses and I may be mixing up problems.
Normaly just after the connect i 127.0.0.1 instruction I'm supposed to received connecting to 127.0.0.1... but I receive nothing.
Any hint on what I'm doing wrong? Is there another kind of stdout that I'm not aware of?
EDIT
I cannot use arguments because I have multiple lines to write, much like with ftp.exe.
Also, ftp.exe does output when you type commands like dir. At least it outputs when you write unknown commands, it complains about Invalid command.