Embed files into binary.
Adam D. Ruppe via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jun 5 19:34:07 PDT 2016
On Monday, 6 June 2016 at 02:05:09 UTC, Pie? wrote:
> I believe the essentially converted the file into a ubyte or
> something and then wrote that out to a temp file and read in
> the temp file... this seems a bit of a kludge to me.
They might do that for certain special cases, but
import("file.whatever") just drops the file content in memory and
you can then access it as an array.
> Because D allows such an embedding feature, maybe the file
> system should allow working with this concept?
Why do you need it through the file system? If you're writing the
code, just use the array in memory. If it is external, see if the
library offers something like that.
DLL and exe are a special case, most things don't need to be
physical files.
More information about the Digitalmars-d-learn
mailing list