|  | Posted by kicken on 06/14/05 04:06 
Dave wrote:> 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.
 
 For a lengthy discussion on the feof topic, see this thread on devshed:
 http://forums.devshed.com/t244304/s.html&highlight=feof
  Navigation: [Reply to this message] |