Skip to contentSkip to conversation

Problem with read() and named pipe (FIFO) (pipe not disk)

DISCUSSION Hossein Mobahi 1 participant 1 message Aug 17, 2004

lore
Share & tools
lore
#0 lore raw

Sure, the stdio's buffer is limited. However, as you said, the real-time constraint doesn't let me wait for the buffer to become full. I need to read it as soon as the data is written to the buffer. So I really need to flush stdio's buffer out of that process.

--Hossein

Quoted 12 lines · --- joy

The program cannot buffer data for all eternity and must eventually
write it to the
pipe. So, even if read() blocks because there is no data available, it
must return as soon as data
is written. The real-time element will be lost though I doubt it will
buffer for a long time.
Is this the behavior you are experiencing and is there a problem with this ?

Quoted 8 lines
Quoted 2 lines · Hossein Mobahi

The solution that I know is using write(STDOUT_FILENO,....) instead of printf because

it

Quoted 1 line

does not buffer. However, I do not have access to

the

Quoted 2 lines

source code of prg1, and I must somehow make prg1
flush its standard I/O buffer from outside.

__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail