Date: 01/27/03
- Next message: Damien Seguy: "[PHP-DOC] cvs: phpdoc /en/reference/mbstring/functions mb-parse-str.xml mb-send-mail.xml"
- Previous message: gaelx <email protected>: "[PHP-DOC] #21877 [Com]: fread may read less bytes than requested even if EOF is not reached ..."
- In reply to: hholzgra <email protected>: "[PHP-DOC] #21877 [NEW]: fread may read less bytes than requested even if EOF is not reached ..."
- Next in thread: hholzgra <email protected>: "[PHP-DOC] #21877 [Ver]: fread may read less bytes than requested even if EOF is not reached ..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 21877
Updated by: philip <email protected>
Reported By: hholzgra <email protected>
-Status: Open
+Status: Verified
Bug Type: Documentation problem
Operating System: *
PHP Version: 4CVS-2003-01-25 (stable)
Assigned To: hholzgra
New Comment:
Try this code instead:
$f = fopen("./foo","r");
while (false !== ($c = fgetc($f))) {
...
}
As this is really what you want to do ;) The documentation for fgetc()
really needs to mention this as most others that might encounter this
0==false do (such as readdir).
A documention problem is to do the following to the fgetc docs:
a) Add an example that keeps in mind false vs 0
b) Implement the &return.falseproblem; entity.
Previous Comments:
------------------------------------------------------------------------
[2003-01-27 19:53:30] gaelx <email protected>
here was my code:
$f=fopen("./foo","r");
while($c=fgetc($f)){
...
}
...and the 'while' loop was quit long before EOF was reached.
After examination, it was quit when a character 0 was read
(thus confusion between 0 and EOF.......)
------------------------------------------------------------------------
[2003-01-25 13:07:29] hholzgra <email protected>
ok, it only true for non-blocking php streams ...
but still this should be mentioned on the fread() page
------------------------------------------------------------------------
[2003-01-25 12:56:17] hholzgra <email protected>
i asume this not only true for C fread() but also for PHP ?
if so -> should be documented as such ...
------------------------------------------------------------------------
-- Edit this bug report at http://bugs.php.net/?id=21877&edit=1-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: Damien Seguy: "[PHP-DOC] cvs: phpdoc /en/reference/mbstring/functions mb-parse-str.xml mb-send-mail.xml"
- Previous message: gaelx <email protected>: "[PHP-DOC] #21877 [Com]: fread may read less bytes than requested even if EOF is not reached ..."
- In reply to: hholzgra <email protected>: "[PHP-DOC] #21877 [NEW]: fread may read less bytes than requested even if EOF is not reached ..."
- Next in thread: hholzgra <email protected>: "[PHP-DOC] #21877 [Ver]: fread may read less bytes than requested even if EOF is not reached ..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

