title: How to flush a pipe created by pipe() on Linux?
body: <p>I want to flush a pipe created by pipe() call on Linux, as i am interested only in data that will come <em>after</em> read() was called. I am trying following ioctl call:</p>
  
  <pre><code>ioctl_err = ioctl(G_MIDI_inout_event_pipe[0],I_FLUSH,FLUSHR);  
  read(G_MIDI_inout_event_pipe[0],&amp;event_type,1);
  </code></pre>
  
  <p>But ioctl returns ENOTTY and pipe is not flushed.
  How to properly flush such stream?</p>