Re: [INTERNALS-WIN] STDIN missing.

[email protected] (Pierre Joye)
Newsgroups php.internals.win
Message-ID <[email protected]>
hi,

Does it work for other scripting language?

As it is not something php can control at this stage.

Cheers,

On Mon, Aug 24, 2009 at 1:44 PM, Richard
Quadling<[email protected]> wrote:
> Hi.
>
> Take the following simple PHP script.
>
> <?php
> while(!feof(STDIN)) {
>        $s = fgets(STDIN);
>        if (!is_null($s)) {
>                fputs(STDOUT, strrev($s));
>        } else {
>                echo "Waiting to get something from STDIN.\r";
>        }
> }
> ?>
>
> Run this from the command line like ...
>
> DIR C:\ | C:\PHP5\php.exe C:\Scripts\Reverse.php
>
> and all is well - the output is reversed - can can be combined with
> other filters ...
>
> DIR C:\*.txt | find /i ".txt" | C:\PHP5\php.exe C:\Scripts\Reverse.php | sort /r
>
> (OK, OTT, but actually works).
>
> Now, following the documentation in [1], I am allowed to use the
> command thus ...
>
> DIR C:\ | C:\Scripts\Reverse
>
>
> It loads (I can see it in Task Manager), but the STDIN isn't getting
> to the PHP script and there is no output.
>
>
>
> OOI. If I just type ...
>
> C:\Scripts\Reverse
>
> STDIN is now waiting for me.
>
> So, if I enter ...
>
> Hello PHP-ers.[enter]
>
> I get output of ...
>
> .sre-PHP olleH
>
> As expected, so the script is talking to STDIN
>
>
>
>
> Does anyone here know what is going on?
>
> Should PHP be getting the piped STDIN?
>
>
> Regards,
>
> Richard.
>
>
> [1] http://docs.php.net/manual/en/install.windows.commandline.php
>
> --
> -----
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
>
> --
> Windows Internals Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
Pierre

http://blog.thepimp.net | http://www.libgd.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.