开发者

What's equivalent c++ "_popen" in C#?

开发者 https://www.devze.com 2023-04-09 12:22 出处:网络
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

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

精彩评论

暂无评论...
验证码 换一张
取 消