[phobos] phobos commit, revision 1877
Andrei Alexandrescu
andrei at erdani.com
Tue Aug 17 08:08:37 PDT 2010
Steve Schveighoffer wrote:
>
>
>
> ----- Original Message ----
>> From: Andrei Alexandrescu <andrei at erdani.com>
>>
>> Steve Schveighoffer wrote:
>>> Second, you cannot do a tell on the file handle, because you need to take
>> into account the buffer.
>>
>> My understanding is that calling fflush() before lseek should be fine. See my
>> upcoming commit.
>
> I'll take a look. But I think you cannot do a relative seek or a tell (which is
> a relative seek of 0) without taking into account the buffer.
>
> Here is the issue:
>
> 1. you open a file.
> 2. you read 4 bytes. The FILE object reads 4096 because it wants to fill up its
> buffer.
> 3. you do a tell, expecting 4. If the function does an lseek64 on the file
> handle, it gets 4096.
I confirm this is the behavior. I finally found the way to do it on OSX
- import core.sys.posix.stdio and then use fseeko and ftello. See my
latest checkin.
Andrei
More information about the phobos
mailing list