title: Read stdout of c program in java
body: <p>So I have a java program that calls a C program through ProcessBuilder, and I need the C program to inform tha Java program when something happens. I have the following code for the java prog:</p>
  
  <pre><code>    String cmd[] = //string to run the c program in the terminal, no probs here
      ProcessBuilder builder = new ProcessBuilder(cmd);
      builder.redirectErrorStream(true);
      Process process = builder.start();
  
      BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
      System.out.println(bufferedReader.ready());
      System.out.println(bufferedReader.readLine());
  </code></pre>
  
  <p>The c program at a given point will have to inform the java program of something. I have tried many things like</p>
  
  <pre><code>char Buff[] = "output";
  write(0, Buff, strlen(Buff)+1);
  write(1, Buff, strlen(Buff)+1);
  printf("output\n");
  </code></pre>
  
  <p>But I cant get the java program to read this, the only output I get is</p>
  
  <pre><code>false
  null
  </code></pre>