note 23224 modified in function.fgetc by cece
| From: | cece@php.net | Date: | Tue, 19 Aug 2003 12:53:39 +0000 |
| Subject: | note 23224 modified in function.fgetc by cece | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-54671@lists.php.net to get a copy of this message | ||
i am using this example, which may or not be properly implemented. i'm running Redhat Linux 7.3
with the php standalone (cgi) version 4.1.2.
$f = fopen("php://stdin", "r+");
set_file_buffer($f, 0);
while(($c = fgetc($f)) != 'X') {
fputs($f, $c); fclose($f);
}
i would think it would echo each typed char unless it was 'X'. it still waits for a \n,
but now returns the entire line. this makes things like tab-completion and other neat cmdline tricks
undo-able, unless i'm missing something obvious. which is, of course, very possible.
--was--
i am using this example, which may or not be properly implemented. i'm running Redhat Linux 7.3
with the php standalone (cgi) version 4.1.2.
<pre>
$f = fopen("php://stdin", "r+"); set_file_buffer($f, 0);
while(($c = fgetc($f)) != 'X') fputs($f, $c); fclose($f);
</pre>
i would think it would echo each typed char unless it was 'X'. it still waits for a \n,
but now returns the entire line. this makes things like tab-completion and other neat cmdline tricks
undo-able, unless i'm missing something obvious. which is, of course, very possible.
http://www.php.net/manual/en/function.fgetc.php