Bug #14003: fgetc from php://stdin doesn't return after one byte typed
| From: | llam at alumni dot uwaterloo dot ca | Date: | Sat, 10 Nov 2001 01:09:42 +0000 |
| Subject: | Bug #14003: fgetc from php://stdin doesn't return after one byte typed | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-69934@lists.php.net to get a copy of this message | ||
From: llam@alumni.uwaterloo.ca
Operating system: Windows 2000
PHP version: 4.0.6
PHP Bug Type: Scripting Engine problem
Bug description: fgetc from php://stdin doesn't return after one byte typed
<?
$rtdin = fopen("php://stdin", "r");
for(;;){
$c = fgetc($rtdin);
fflush($rtdin);
if ($c == 'q') break;
else echo "you pressed:" . $c . "\n";
}
?>
=========
This script doesn't work as expected: fgetc doesn't return until "\n" is
read from stdin.
How can I catch single key-presses from the keyboard?
--
Edit bug report at: http://bugs.php.net/?id=14003&edit=1