|
Posted by Daniel Klein on 12/23/07 19:42
On Sun, 23 Dec 2007 14:50:59 GMT, Daniel Klein
<danielk@featherbrain.net> wrote:
>On Mon, 24 Dec 2007 00:44:14 +1000, "Vince Morgan"
><vinharAtHereoptusnet.com.au> wrote:
>
>>"Daniel Klein" <danielk@featherbrain.net> wrote in message
>>news:u89qm352ob3hep0heags7bd82q3seqcdjb@4ax.com...
>>> I'm trying to get popen to work on Windows.
>>>
>>> Here's a simplified example of what I'm trying to get working:
>>>
>>> I have a hw.c program as follows:
>>>
>>> #include <stdio.h>
>>> main()
>>> {
>>> printf ("Hello World!\n");
>>> }
>>>
>>> And here's the 'popentest.php' code:
>>>
>>I could be wrong, but "printf()" is going to want to output to a consul, and
>>I can't see how you are going to capture the output via "popen()" which is
>>expecting a file pointer. You need to capture the output as a string so
>>that it can be output to the server as HTML or whatever. However you cannot
>>return a string from a C executable.
>
>'printf()' is sending the output, as a string, to STDOUT so I would
>think 'popen()' / 'fgets()' should be able to handle that.
Just to be thorough, I created a php script:
<?php
echo "Hi";
?>
and replaced the 'hw.exe' with 'php hi.php' - I got the same problem
as originally reported.
I also tested 'php pipetest.php' from a telnet session, which (I
think) proves that it does not require a 'console'.
I'm getting to the point where I'm wondering if this is a Windows
limitation, but I do not have a unix-like box to test out this theory.
Daniel Klein
[Back to original message]
|