Posted by Dave on 06/14/05 01:36
Wolfgang Werners-Lucchini (wwl@musensturm.de) decided we needed to
hear...
> Hallo!
>
> The code here outputs '0'. Why?
> ----------------------------
> $filename = "test.dat";
> if (!file_exists($filename)) {
> touch($filename); // Create blank file
> chmod($filename,0666);
> }
> $fp=fopen($filename,'r');
> if ($fp && !feof($fp)) echo ftell($fp); // should output nothing!
> fclose($fp);
> ----------------------------
> Wolfgang
Output of '0' is correct. EOF condition gets set on a read, not on
an open, and you don't read from the file.
--
Dave <dave@REMOVEbundook.com>
(Remove REMOVE for email address)
[Back to original message]
|