note 9744 added to fgetc
| From: | meyowith at home dot com | Date: | Tue, 21 Nov 2000 21:39:39 +0000 |
| Subject: | note 9744 added to fgetc | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-7961@lists.php.net to get a copy of this message | ||
I was in dalnet's #Linux channel at 6am and sleep deprivation made an op and I realize that
infact, you could open STDIN and STDOUT with php for console operations.
/dev/stdout, /dev/stdin, and basicly any other /dev/ listing.
This is for unix based systems, athough you should be able to open \std or \STD on windows
installations.
Function Readln(){
$info_IN = fopen("/dev/stdin","r");
while (!feof($info_IN)) {
$IN = fgetc($info_IN);
if ($IN == "n"){
echo $IN;
}
}
fclose($info_IN);
}
Pretty nifty huh?
http://www.php.net/manual/function.fgetc.php