Reply to Unbuffered Reads

Your name:

Reply:


Posted by Steven James Samuel Stapleton on 06/05/05 10:29

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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация