Re: Re: STDIN Stream Query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux