[python-win32] win32pipe and buffer size
Gabriel Genellina
gagenellina at softlab.com.ar
Wed Jul 13 04:12:12 CEST 2005
At Tuesday 12/7/2005 13:09, Frank Guenther wrote:
>That is exactly the problem, but how can I get the text which the
>buffering client prints to the screen?
>
>The C++ Code looks like:
>
> printf ("1. Run Static Tests contained in Sections 5 through
> 9.\n");
> printf ("2. Run Dynamic Tests contained in Sections 10 through
> 11.\n\n");
> printf ("Enter choice (1 or 2): ");
> scanf ("%d", &nTestChoice);
>
>If I use the program manually the stdout is displayed on the screen.
>
>A solution would be to change the program, but I don't have the
>possibility to change it.
>Is there an other way?
See the C FAQ on this topic: http://www.eskimo.com/~scs/C-faq/q12.4.html
If the OS is buffering the output, perhaps a call to FlushFileBuffers (on
the other end of the pipe) would help.
But if the buffering is at the C run-time library, I'm afraid there is
nothing you could do to flush the output without rewriting the code or
hacking the RTL DLLs.
To disable buffering on stdout, put any of these calls at the very
beginning of the program:
setbuf(stdout, NULL)
or: setvbuf(stdout, NULL, _IONBF, 0)
Gabriel Genellina
Softlab SRL
More information about the Python-win32
mailing list