View topic - Clear a Pipe (or a FIFO)

Clear a Pipe (or a FIFO)

anything that doesn't fit to other groups.

Clear a Pipe (or a FIFO)

Postby Mr.Green » Thu Dec 02, 2010 8:47 am

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
Mr.Green
Active Member
 
Posts: 37
Joined: Tue Nov 11, 2008 12:21 pm

RE: Clear a Pipe (or a FIFO)

Postby mario » Thu Dec 02, 2010 5:03 pm

I think tcflush should work.
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

RE: Clear a Pipe (or a FIFO)

Postby Mr.Green » Tue Dec 14, 2010 10:46 am

It doesn't seem to be working.
I tried to flush (tcflush(pipe_fd[0], TCIOFLUSH );) 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.
Mr.Green
Active Member
 
Posts: 37
Joined: Tue Nov 11, 2008 12:21 pm

RE: Clear a Pipe (or a FIFO)

Postby mario » Tue Dec 14, 2010 7:08 pm

do
{
timertimeout()
read()
} while ( until no data left );
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

RE: Clear a Pipe (or a FIFO)

Postby Mr.Green » Thu Dec 16, 2010 1:14 pm

Thanks :)
Mr.Green
Active Member
 
Posts: 37
Joined: Tue Nov 11, 2008 12:21 pm


Return to General Programming

Who is online

Users browsing this forum: No registered users and 5 guests