trying to use popen2() to communicate with C program
No.Spam at Spam.none
Tue Mar 28 22:07:34 CEST 2006
Dennis Lee Bieber wrote:
> On Tue, 28 Mar 2006 18:02:46 GMT, "I. Myself" <No.Spam at Spam.none>
> declaimed the following in comp.lang.python:
>> The compile C program, commer.exe, writes a line of text to its stdout.
>> The python program does not receive it; it never gets to print "Got here
>> 2". Commer.exe does begin execution. Here's commer.c, but there
>> appears to be no problem with it. Commer.exe can be executed alone, and
>> it behaves as expected.
> Try flushing stdout... Many C runtimes detect when stdout is not a
> console and go to a buffered output mode; without a flush, it may be
> holding data until a (disk) block is filled...
That worked! I put fflush(stdout); after the printf() statement,
and that fixed it.
I'm proud of http://ANNEvolve.sourceforge.net. I'm currently working on a
major update of the SailChallenge package. If you want to write software,
or articles, or do testing for ANNEvolve, let me know.
Humans may know that my email address is zenguy at shaw789 dot ca.
(Remove the 3-digit number.)
More information about the Python-list