我正在使用以下代码。
我的问题是我无法正确读取
我使用的程序似乎甚至在命令行中运行时也不会写入
现在我知道提示必须使用某种
通常,在
请问我做错了什么?还有其他类型的
编辑
我不能使用参数,因为我有多行要写,就像
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();
我的问题是我无法正确读取
stdout
。但是我可以轻松地写入stdin
,现在我正在尝试实现一些错误检查代码,但它不起作用。我使用的程序似乎甚至在命令行中运行时也不会写入
stdout
。我可以使用默认情况下随Windows XP
提供的ftp.exe
重现此bug
。如果将-> FileName
更改为ftp.exe
,则命令提示符ftp.exe
通常会给出ftp>
,但不会显示在prg_output
中。现在我知道提示必须使用某种
windows shell curses
,而我可能会混淆问题。通常,在
connect i 127.0.0.1
指令之后,我应该接收到connecting to 127.0.0.1...
,但我什么也没收到。请问我做错了什么?还有其他类型的
stdout
我不知道吗?编辑
我不能使用参数,因为我有多行要写,就像
ftp.exe
一样。此外,当您键入命令(如dir)时,ftp.exe
确实会输出。至少当您写入未知命令时,它会抱怨“无效的命令”。