Read files at compile time

Deewiant deewiant.doesnotlike.spam at gmail.com
Thu May 31 01:35:08 PDT 2007


Henrik wrote:
> Is it possible to read a file at compile-time in the manner I am trying to do?

Using splitlines() won't work: it allocates memory, which makes it ineligible
for CTFE. It probably does other disallowed stuff, too.

You can use import expressions to read the file into a char[], but splitting on
lines at compile time is a bit trickier. You'll need to write a template to do
the split.


More information about the Digitalmars-d-learn mailing list