चलाते समय प्रक्रिया आउटपुट प्राप्त करें क्या किसी भी तरह की प्रक्रिया के मानक आउटपुट को रीडायरेक्ट करने और इसे होने के रूप में कैप्चर करने के लिए वैसे भी है। प्रक्रिया पूरी होने के बाद मैंने जो कुछ भी देखा है, वह केवल ReadToEnd करता है। मैं आउटपुट प्राप्त करने में सक्षम होना चाहता हूं क्योंकि इसे मुद्रित किया जा रहा है।सी #
संपादित करें:
private void ConvertToMPEG()
{
// Start the child process.
Process p = new Process();
// Redirect the output stream of the child process.
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
//Setup filename and arguments
p.StartInfo.Arguments = String.Format("-y -i \"{0}\" -target ntsc-dvd -sameq -s 720x480 \"{1}\"", tempDir + "out.avi", tempDir + "out.mpg");
p.StartInfo.FileName = "ffmpeg.exe";
//Handle data received
p.OutputDataReceived += new DataReceivedEventHandler(p_OutputDataReceived);
p.Start();
}
void p_OutputDataReceived(object sender, DataReceivedEventArgs e)
{
Debug.WriteLine(e.Data);
}
हां, और इसके अतिरिक्त आपको काम करने के लिए 'RedirectStandardOutput' को सही करने की आवश्यकता है। – vcsjones
@vcsjones: बस अतिरिक्त पोस्ट wrinting। – Tigran
उत्तर में [यहां पर] (http://stackoverflow.com/a/3642517/74757)। –