|
Posted by Daniel Klein on 12/23/07 14:50
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.
Can anyone else substantiate this?
Daniel Klein
[Back to original message]
|