Working with files over 2GB in D2

dsimcha dsimcha at yahoo.com
Fri Oct 16 21:43:30 PDT 2009


== 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?



More information about the Digitalmars-d mailing list