|  | Posted by Jerry Stuckle on 12/28/07 02:39 
Vince Morgan 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:
 >>
 >> popen test...
 >> <?php
 >>    $fp = popen('C:\\home\\bin\\hw.exe', 'r');
 >>    $data = fread($fp, 1024);
 >
 > According to the manual the file pointer that is returned by "popen()" can
 > be used by the following, fgets(), fgetss(), and fwrite() whereas you are
 > calling "fread()".
 >
 
 Not a problem.  fread() can use the handle returned by popen() also.
 See further down where there is an example of that.
 
 >> It works when I run this from a command prompt:
 >>
 >> C:\Inetpub\wwwroot\php>php popentest.php
 >> popen test...
 >> Hello World!
 > That is because hw.exe is outputting to the consol when it runs I would
 > think
 > http://www.php.net/popen
 > HTH,
 > Vince
 >
 >
 >
 
 Not knowing what hw.exe is doing, it's hard to say.
 
 --
 ==================
 Remove the "x" from my email address
 Jerry Stuckle
 JDS Computer Training Corp.
 jstucklex@attglobal.net
 ==================
  Navigation: [Reply to this message] |