linux how to flush pipes to clean the buffer in c when