1. Simple method:
Process P = Process.Start("eyeDetect.exe", "hello1.jpg haarcascade_frontalface_alt.xml haarcascade_eye.xml");
P.StartInfo.UseShellExecute = false;
P.WaitForExit();
int result = P.ExitCode;
Console.WriteLine("Here is my result " + result);
Console.ReadLine();
2. Descriptive Method:
using System;2. Descriptive Method:
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
StringBuilder Output = new StringBuilder();
using (Process proc = new Process())
{
proc.StartInfo.FileName = "eyeDetect.exe";
proc.StartInfo.Arguments = "hello1.jpg haarcascade_frontalface_alt.xml haarcascade_eye.xml";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardError = true;
proc.OutputDataReceived += (o, e) => Output.Append(e.Data).Append(Environment.NewLine);
proc.Start();
proc.BeginOutputReadLine();
proc.BeginErrorReadLine();
proc.WaitForExit();
int ExitCode = proc.ExitCode;
}
Console.WriteLine(Output);
Console.ReadLine();
}
}
}
really help full....... thanx lot..
ReplyDelete