note 58026 added to function.ftell
| From: | mbirthatwebwritersdotde at osu1 dot php dot net | Date: | Fri, 21 Oct 2005 18:09:41 +0000 |
| Subject: | note 58026 added to function.ftell | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-97377@lists.php.net to get a copy of this message | ||
Attention! If you open a file with the "text"-modifier (e.g. 'rt') and the file
contains \r\n as line-endings, ftell() returns the position as if there were only \n as
line-endings.
Example:
If the first line only contains 1 char followed by \r\n, the start of the second line should be
position 3. (1char + \r + \n = 3 bytes) But ftell() will return 2 - ignoring one byte. If you call
ftell() in line 3, the value will differ from the real value by 2 bytes. The error gets greater with
every line.
(Watched this behavior in PHP 5.0.4 for Windows.)
BUT: fseek() works as expected - using the true byte values.
----
Manual Page -- http://www.php.net/manual/en/function.ftell.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+58026
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58026&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58026&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58026&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58026&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58026&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58026&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58026&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+58026&report=yes
Search -- http://master.php.net/manage/user-notes.php