Re: pipe buffering
- From: "Tom Widmer [VC++ MVP]" <tom_usenet@xxxxxxxxxxx>
- Date: Fri, 23 Sep 2005 12:14:06 +0100
ptroyev wrote:
child's stdout is directed to write-end of pipe, output is read from read-end of pipe (in caller),
the problem is with buffering, is there a way to disable buffering on pipe?
Do you have access to the source code of "child"?
when child's output slows to 1-2chars /sec (progress indicator- "... ok") the read-end
of pipe is empty, it waits until buffer fills up and then gives the whole string.
seems that CreatePipe ignores its buffer-size parameter if set to 1,
tried to use ofs_handle + setbuf/setvbuf and also created the pipe with CreateFile with
FILE_FLAG_NO_BUFFERING, but nothing really changed
maybe it's because not tty handle is line-buffered by default
When you say stdout, do you mean the FILE* stdout? That's buffered, so are you using fflush in the child process? There are two layers of buffering here - CRT buffering of stdout and Windows buffering of the pipe. I think the child needs to use fflush for the first and FlushFileBuffers for the second.
Tom .
- Follow-Ups:
- Re: pipe buffering
- From: ptroyev
- Re: pipe buffering
- References:
- pipe buffering
- From: ptroyev
- pipe buffering
- Prev by Date: Re: Reading individual pins from the parallel port
- Next by Date: Re: Postfix increment
- Previous by thread: pipe buffering
- Next by thread: Re: pipe buffering
- Index(es):
Relevant Pages
|