STDIN Stream Query

From: Date: Thu, 16 Aug 2007 13:53:42 +0000
Subject: STDIN Stream Query
Groups: php.general 
Request: Send a blank email to php-general+get-260916@lists.php.net to get a copy of this message
Hi All I am having a problem getting stream_set_blocking to work the way I expect on STDIN. Please could someone tell me why while blocking is set to false fread does not get anything. Sampe code follows: Code: <?php stream_set_blocking(STDIN, false); fputs(STDOUT, chr(27)."[6n"); sleep(1); fputs(STDOUT, "\r\n"); for ($i = 0; $i < 10; $i++){ $pos = fread(STDIN, 1024); fputs(STDOUT, "-->".$pos."\r\n"); sleep(1); } stream_set_blocking(STDIN, true); $pos = fread(STDIN, 1024); fputs(STDOUT, "-->".$pos."\r\n"); ?> Actual Output: php5 test.php ^[[24;1R --> --> --> --> --> --> --> --> --> --> --> Expected Output: php5 test.php ^[[24;1R --> --> --> --> --> --> --> --> --> --> --> Thanks Jason

« previous php.general (#260916) next »