Running a c++ console app inside a C# console app -


i have c++ console app runs in visual studio. collects data , displays in console raw data.

another app (c#) used collect information , present ui.

is possible combine 2 putting c++ 1 inside c# 1 both run @ same time 1 service c++ app outputting info panel or similar?

thanks! :)

a quick example have said earlier this:

private void executecommand(string programfilepath, string commandlineargs, string workingdirectory)     {         process myprocess = new process();          myprocess.startinfo.workingdirectory = workingdirectory;         myprocess.startinfo.filename = programfilepath;         myprocess.startinfo.arguments = commandlineargs;         myprocess.startinfo.useshellexecute = false;         myprocess.startinfo.createnowindow = true;         myprocess.startinfo.redirectstandardoutput = true;         myprocess.startinfo.redirectstandarderror = true;         myprocess.start();          streamreader sout = myprocess.standardoutput;         streamreader serr = myprocess.standarderror;          try         {             string str;              // reading errors , output async...              while ((str = sout.readline()) != null && !sout.endofstream)             {                  logmessage(str + environment.newline, true);               application.doevents();               sout.basestream.flush();             }              while ((str = serr.readline()) != null && !serr.endofstream)             {               logerror(str + environment.newline, true);               application.doevents();               serr.basestream.flush();             }              myprocess.waitforexit();         }                 {             sout.close();             serr.close();         }     } 

surely it's not perfect worked when executing powershell script, seeing output in multiline textbox updating whenever new came out, method updated textbox logmessage()


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -