1
在c#中流很流畅,但我对基础知识有点熟悉。按块发送流块
我需要帮助设置挂钩到未知长度的流中最有效的方式,并将读取的部分发送到另一个函数,直到到达流的末尾。是否有人可以看看我喜欢什么,并帮助我填写while循环中的部分,或者如果while循环不是最好的方式告诉我什么更好。任何帮助深表感谢。
var processStartInfo = new ProcessStartInfo
{
FileName = "program.exe",
RedirectStandardInput = true,
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true,
Arguments = " -some -arguments"
};
theProcess.StartInfo = processStartInfo;
theProcess.Start();
while (!theProcess.HasExited)
{
int count = 0;
var b = new byte[32768]; // 32k
while ((count = theProcess.StandardOutput.BaseStream.Read(b, 0, b.Length)) > 0)
{
SendChunck() // ?
}
}
谢谢!这让我更了解了一些! –