capture output from c++ in java without returning -


i'm working on java swing make gui c++ programming . need c++ program executed in loop without returning java. during loop want capture output without stepping through return 0; in c++ program

can capture output c++ file without returning java gui ?? out , in process in code

 try {                 int out = 0;                 string line;                 outputstream stdin = null;                 inputstream stderr = null;                 inputstream stdout = null;                  // calling exe file                 process process = new processbuilder("unpattern.exe").start();                 stdin = process.getoutputstream();                 stderr = process.geterrorstream();                 stdout = process.getinputstream();                  // input process                 // "write" parms stdin                 line = "1";                 stdin.write(line.getbytes());                 stdin.flush();                  //line = "tx.gettext()" + "\n";                 // stdin.write(line.getbytes());                // stdin.flush();                  stdin.close();                  // output process                 // clean if output in stdout                 bufferedreader brcleanup =                         new bufferedreader(new inputstreamreader(stdout));                  while ((line = brcleanup.readline()) != null) {                     // counter of defects                     system.out.println(line);              } catch (ioexception ex) {                 logger.getlogger(qeyegui3.class.getname()).log(level.severe, null, ex);             } 

your while loop missing closing brace:

            // ....             while ((line = brcleanup.readline()) != null) {                 // counter of defects                 system.out.println(line);             // **** should go here         } 

i suggest continuously text passed bufferedreader in while loop. if doing within swing application's swingworker, use publish/process method pair update swing gui information transmitted.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -