php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15528 ftell does not work consistently
Submitted: 2002-02-12 15:12 UTC Modified: 2002-02-12 17:07 UTC
From: ilia at prohost dot org Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.1.1 OS: Any Windows OS
Private report: No CVE-ID: None
 [2002-02-12 15:12 UTC] ilia at prohost dot org
In Windows ftell() will ALWAYS return 0, if called right after fopen() for append, even if the file has data in it.

In UNIX this instead would show the position inside the file and can be used to determine the filesize prior to writing data.

This happends because of the different implementation of file append in Windows due to nature of NTFS file system.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-12 17:07 UTC] mfischer@php.net
That's the way it has been implemented my M$ and it's even documented:

"Note that when a file is opened for appending data, the current file position is determined by the last I/O operation, not by where the next write would occur. For example, if a file is opened for an append and the last operation was a read, the file position is the point where the next read operation would start, not where the next write would start. (When a file is opened for appending, the file position is moved to end of file before any write operation.) If no I/O operation has yet occurred on a file opened for appending, the file position is the beginning of the file.
"
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 08 02:01:34 2025 UTC