I'm trying to write this java program that calls a .exe file and read in the result.
The .exe file is written in c and has something like printf("hello") at the end.
I tried to do this:
try {
Process p = Runtime.getRuntime().exec("c:\\test\\a.exe");
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
System.out.println(br.readLine());
br.close();
}
catch (Exception err) {
err.printStackTrace();
}
but it keeps giving me null as a result.
Obviously I'm doing something worng, but I can't figure out what is it.
I would really appreciate if someone can help me with it.