`string[] args` can't be read at compile time?
Unazed Spectaculum
unazed at spec.org
Sun Dec 10 15:28:19 UTC 2017
import std.stdio;
import std.file;
void main(string[] args)
{
if (args.length != 2)
{
writeln("usage: ./app <path-to-file>");
return;
}
if (!exists!(args[1]))
{
writefln("fatal error: %s doesn't exist", args[1]);
}
}
Line 13 (if (!exists!(args[1]))) produces error:
'app.d(13): Error: variable args cannot be read at compile time'
With 'dmd -run app.d' compilation command. I've seen another
Stackoverflow post with a similar issue
(https://stackoverflow.com/questions/39920780/variable-i-cannot-be-read-at-compile-time) but I don't believe it to be related.
Any help?
More information about the Digitalmars-d-learn
mailing list