简体   繁体   English

在C#中,什么是等效的c ++“_popen”?

[英]What's equivalent c++ “_popen” in C#?

What's equivalent c++ "_popen" in C#? 在C#中,什么是等效的c ++“_popen”? I would like open file with some command into stream. 我想用一些命令打开文件流。 eg 例如

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

thanks in advance. 提前致谢。

Check out: 查看:

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

Here's a snippit: 这是一个snippit:

// 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();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM