title: how to stop reading "cat /dev/urandom"?
body: <p>i am writing a program that read the standard input.i have a loop like this :</p>
  
  <pre><code>while(read(0, buffer, sizeof(buffer)) &gt; 0)
  </code></pre>
  
  <p>it works fine, but when i do a cat /dev/urandom | ./myprogram the loop never stop.So i would like to stop reading after some time elapsed.</p>