Jason Freeman wrote:

> Per Jessen wrote:
>>
>> When a file descriptor (stdin) is non-blocking, any read() will not
>> block and wait for data to become available, but will return right
>> away with or without data.  Set the fd to blocking to wait for data.
>>
> 
> This is true which is why I put fread() into a loop. If you look at
> the output you will see that data is available even before the first
> iteration. PHP only seems to recognize this though when the enter key
> is pressed. If I press the enter key while blocking is off then it
> finds the data. Is there any way to get the PHP to recognize that data
> is available without pressing the enter key?

So you want to read from stdin byte for byte?  If so, I suspect your
problem is in the normal stream buffering. 

I don't know if terminal IO is really feasible with PHP. Maybe you
should check out the ncurses interface?


/Per Jessen

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to