Firstly, I saw several questions about this problem on the site, but did not see the answer that solves my problem.
I have a program written in Java and it calls the cmd program written in C ++. (this is an assumption since I have no actual source). I know the expected input / output of a C ++ program, in cmd these are two lines of output, and then it expects a line input. I know that the first output line of the program is through the error stream, and I get it correctly (this is expected), but I do not get the second line in the error or in the input stream. I tried to write a program immediately after the first line (error line) and did not get stuck, but there was no answer. I tried to use 3 different streams for each stream, but again, nothing was received in the input / error stream after the first line, and the program did not respond to recording through the output stream.
My initializers:
Process p = Runtime.getRuntime().exec("c:\\my_prog.exe"); BufferedReader err = new BufferedReader(new InputStreamReader(p.getErrorStream())); BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedWriter output = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
Is it possible at all, or perhaps it depends on a C ++ program?
Thank you Binyamin
source share