What's equivalent c++ "_popen" in C#?
What's equivalent c++ "_popen" in C#? I would like open file with some command into stream. e.g.
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
Here's a 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();
精彩评论