title: Linux pipe : Capturing realtime output of ping via popen
body: <p>Linux/C/pipes:</p>
  
  <p>How can I capture the output of ping command using popen(Or similar system calls).
  Currently popen will wait until ping is finished. Then output will be dumped together. </p>
  
  <p>Pseudo code:</p>
  
  <pre><code>fp= popen("ping x.x.x.x", "r");
  while(!feof(pFp))
  {
     if(fgets(fp ...) // &lt;==currently the code blocks here until ping finishes in popen
     { 
         printf(...real time ping output here);
     }
  }
  </code></pre>