You are here: Re: feof() « PHP Programming Language « IT news, forums, messages
Re: feof()

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация