STDIN missing.

From: Date: Mon, 24 Aug 2009 11:44:12 +0000
Subject: STDIN missing.
Groups: php.internals.win 
Request: Send a blank email to internals-win+get-571@lists.php.net to get a copy of this message
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

« previous php.internals.win (#571) next »