05-Jan-2014 09:22, Jason White пишет:
On Saturday, 4 January 2014 at 13:32:15 UTC, Dmitry Olshansky wrote:
IMHO C run-time I/O has no use in D. The amount of work spent on
special-casing the non-locking primitives of each C run-time,
repeating legacy mistakes (like text mode, codepages and locales) and
stumbling on portability problems (getc is a macro we can't have)
would have been better spent elsewhere - designing our own I/O framework.

I agree. I wrote a (mostly complete) file stream implementation that
uses the native I/O API:

     https://github.com/jasonwhite/io/blob/master/src/io/file.d

As an advice I'd suggest to drop the 'Data' part in writeData/readData. It's obvious and adds no extra value.

It allows for more robust open-flags than the fopen-style flags (like
"r+"). For seeking, I adapted it to use your concept of marks (which I
quite like) instead of SEEK_CUR and friends.

Please feel free to use this! (The Windows implementation hasn't been
tested yet, so it probably doesn't work.)

Will poke around. I like this (I mean composition):
https://github.com/jasonwhite/io/blob/master/src/io/stdio.d#L17


BTW, I was also working on buffered streams, but couldn't figure out a
good way to do it.


--
Dmitry Olshansky

Reply via email to