【问题标题】:What's equivalent c++ "_popen" in C#?C# 中等效的 c++“_popen”是什么?
【发布时间】:2018-04-17 02:15:02
【问题描述】:

C# 中的等效 c++“_popen”是什么?我想用一些命令打开文件到流中。 例如

ffmpeg -i "D:\Downloads\shakira.mp3"  -ac 1 -ar 11025 -f s16le -t 20 -ss 20 - 2>nul

提前致谢。

【问题讨论】:

    标签: c#


    【解决方案1】:

    退房:

    http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.redirectstandardoutput.aspx

    这是一个片段:

    // Start the child process.
    Process p = new Process();
    // Redirect the output stream of the child process.
    p.StartInfo.UseShellExecute = false;
    p.StartInfo.RedirectStandardOutput = true;
    p.StartInfo.FileName = "Write500Lines.exe";
    p.Start();
    // Do not wait for the child process to exit before
    // reading to the end of its redirected stream.
    // p.WaitForExit();
    // Read the output stream first and then wait.
    string output = p.StandardOutput.ReadToEnd();
    p.WaitForExit();
    

    【讨论】:

      猜你喜欢
      • 2012-10-30
      • 2019-06-26
      • 2010-11-27
      • 1970-01-01
      • 1970-01-01
      • 2019-12-22
      • 1970-01-01
      • 1970-01-01
      • 2016-07-14
      相关资源
      最近更新 更多