On Tuesday, May 28, 2013 16:04:32 Russel Winder wrote: > Hi, > > I think I am missing something very obvious… > > For unit tests I want a std.stdio.File object that is backed by an in > memory string buffer rather than an actual file on disc, be it temporary > or otherwise. I think I am missing where this is documented in the > documentation. Or is it actually not available?
Do you mean something like std.mmfile.MmFile which operates on a file as an array in memory using mmap, or do you mean operating on memory that has no connection to a file at all (in which case, I'm not sure why you'd want to use File)? If the former, well use std.file.MmFile. If the latter, I expect that you're out of luck. Unfortunately, std.stdio.File is currently just a wrapper around FILE and is thus limited by what you can do with FILE - that and I don't think that the File API took into consideration the possibility of operating on anything other than an actual file (and I honestly don't know what you'd be trying to do with it where it would make any sense for to operate on anything other than an actual file). - Jonathan M Davis