Unbuffered Reads

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

 



Is there any way to perform an unbuffered read in PHP when reading from STDIN?

I.E. if I have the code

---------------------
$chr = "";
while(!feof(STDIN))
{
 $chr = fgetc(STDIN); //I could just as easily do fread(STDIN, 1)
 if($chr == " ")
   break;
}
---------------------

and enter the following string (note this is how you would enter the string in a program to have it have the same value I'd type in):
"this is a test\n"

It will stop reading at the newline, and not the first space.

Any ideas?


System Info
Environment: Windows XP Pro (used both the windows and cygwin command lines)
PHP Version: 5.0.3

Thanks
-Jim Stapleton
--
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