fopencookie, fmemopen, open_memstream, open_wmemstream are missing in std.file .
If std.file.File is actually supposed to be a wrapper for FILE* (is it?), it would be nice to have these available.
fmemopen, open_memstream and open_wmemstream are Posix standard functions.
These deal with reading/writing from an array using File I/O (i.e. like C++ sstream, Python StringIO).
--
fopencookie is a GNU extension.
This would allow to register your own reading/writing implementation per instance.
It would also be useful for interoperability with C libraries using FILE* in this manner in their interface.
Comment #1 by danny.milo — 2014-11-19T23:50:21Z
Then, also, File would need to be able to use such a thing. I'm not sure how one goes from a FILE* to a File. Does this work already?
Comment #2 by issues.dlang — 2014-11-22T06:56:11Z
Do you mean std.stdio.File? There is no File type in std.file, and nothing there wraps a FILE* or even uses it internally. The functions in std.file operate on an entire file at once rather than open it to keep it open for doing multiple operations on it.
Comment #3 by danny.milo — 2014-11-22T12:49:52Z
Yes, I mean't std.stdio.File . But the FILE* parts seem to be in core.sys.posix.stdio (fopen etc).
Comment #4 by danny.milo — 2014-11-22T17:51:25Z
(But _GNU_SOURCE is only true in core.sys.linux , so changing to that)
Comment #5 by danny.milo — 2014-11-22T18:20:46Z
Created attachment 1456
core/sys/linux/stdio.d (new file)
interface for fopencookie