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

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.)

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

Reply via email to