Working with files over 2GB in D2

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Oct 17 05:35:41 PDT 2009


dsimcha wrote:
> == Quote from Jeremie Pelletier (jeremiep at gmail.com)'s article
>> dsimcha wrote:
>>> Does anyone know how to work with huge (2GB+) files in D2?  std.stream has
>>> overflow bugs (I haven't isolated them yet) and can't return their size
>>> correctly, std.stdio.File throws a ConvOverflowError in seek() because fseek()
>>> apparently takes an int when it should take a long, and std.file only supports
>>> reading the whole file, which I can't do in 2GB address space.
>>>
>>> It appears none of the file I/O on Phobos has been tested on huge files (until
>>> now).
>> What platform are you using? You should report your issue on bugzilla.
>> I had similar issues on windows when using stdio's fseek and ftell, I
>> had no problems using GetFilePointerEx, you could try that while it is
>> fixed.
>> Jeremie
> 
> Mostly Linux.  Everything seems to be working on Windows, though I haven't tested
> it that thoroughly.  I will file Bugzillas eventually, but I'm still trying to
> understand some of these issues, i.e. to what extent they're limitations vs. real
> bugs.
> 
> What I'm really interested in knowing is:
> 
> 1.  To what extent is the fact that working with 2GB+ files a platform limitation
> rather than a real bug?  (I vaguely understand that it has to do with files being
> indexed by signed ints, but I don't know the details of how it's implemented on
> each platform and what is different between platforms.)
> 
> 2.  Does anyone know of a method of doing file I/O in D2 that is well-tested with
> files above 2GB?

No, but I'd be glad to fix any bugs you may find in std.stdio. I fixed a 
couple myself, but it looks there are more to go.

Andrei



More information about the Digitalmars-d mailing list