Unable to open filename passed as command line argument

Curious curiour at home.com
Thu Sep 3 10:47:04 UTC 2020


Given the following:

=====a======
void main(string[] args)
{
     FILE* fp = fopen(args[1].ptr, "r");
     if (!fp) throw new Exception("fopen");
}

=====b======
void main(string[] args)
{
     FILE* fp = fopen(args[1].dup.ptr, "r");
     if (!fp) throw new Exception("fopen");
}

Why does a fail but b succeed?


More information about the Digitalmars-d-learn mailing list