randomIO, std.file, core.stdc.stdio
Rene Zwanenburg via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jul 27 06:46:45 PDT 2016
On Wednesday, 27 July 2016 at 02:20:57 UTC, Charles Hixson wrote:
> O, dear. It was sounding like such an excellent approach until
> this
> last paragraph, but growing the file is going to be one of the
> common
> operations. (Certainly at first.) (...)
> So I'm probably better off sticking to using a seek based i/o
> system.
Not necessarily. The usual approach is to over-allocate your file
so you don't need to grow it that often. This is the exact same
strategy used by D's dynamic arrays and grow-able array-backed
lists in other languages - the difference between list length and
capacity.
There is no built-in support for this in std.mmfile afaik. But
it's not hard to do yourself.
More information about the Digitalmars-d-learn
mailing list