On Wed, 02 Nov 2005 23:22:24 -0600, Greg Donald wrote: > On Wed, 2005-11-02 at 21:58 +0000, Curt Zirzow wrote: >> The internal STDIN pointer? there is no such thing by the name of STDIN >> in php. > > Sure there is, php://stdin. > http://php.net/manual/en/wrappers.php.php My point in context was since he was apparently using php code since reset() returned an error, i was saying that there is no such constant called STDIN in php. > >> According to http://php.net/reset it epxects an array not a file handle, >> so the error would be expected. >> >> I might be wrong but stdin is not seekable so i doubt it is even possble >> to put the file handle back to the beginning. > > A file handle to php://stdin can be created with fopen(). > http://php.net/manual/en/function.fopen.php > > rewind() works on file handles. > http://php.net/manual/en/function.rewind.php My point was that rewind isn't going to work 100% of the time and i believe php://stdin is one of them. consider: <?php $fp = fopen('http://google.com/', 'r'); if(! $fp) exit('nope'); $foo = fgets($fp); rewind($fp); ?> Output: PHP Warning: rewind(): stream does not support seeking in /usr/home/curt/bin/t.php on line 7 To me rewinding stdin, is rather pointless, since: <?php $fp = fopen('php://stdin', 'r'); if(! $fp) exit('nope'); $foo = fgets($fp); rewind($fp); $foo = fgets($fp); ?> fgets() basically only returns when the keybored buffer is filled and sent to it; accepts the data and the pointer is sitting waiting for data, there isn't a way to rewind() and get the original buffer that was sent, it is long gone and in the first $foo that is why i ask why the need to consider rewinding the stdin. Curt. -- http://news.zirzow.dyndns.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php