Clear a Pipe (or a FIFO)

Hi,
how can I manage to clear a POSIX Pipe?
I think they are very handy, but under some circumstances, I need to clear the content.

Or if that isn’t possible: Would that work with a FIFO? I have browsed through the Forum but only found tcflush(), what I think is just usable with a kind of Hardware FIFO (like UART), isn’t it?

Regards,
Mr.Green

I think tcflush should work.

It doesn’t seem to be working.
I tried to flush (tcflush(pipe_fd[0], TCIOFLUSH ):wink: both the Read- and the Write-End of the Pipe, but it doesn’t have any effect.

Any other possibilities, or do I have to implement an own queue?

Edit: I also tried to flush the Read-End with TCIFLUSH only, but still no action.

do
{
timertimeout()
read()
} while ( until no data left );

Thanks :slight_smile: