crash on args.getopt

Tobias Pankrath via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jan 24 11:51:13 PST 2015


> http://dlang.org/phobos/std_getopt.html
>
> But problem that I do not know how handle not existing values:
>
> void main(string[] args)
> {
> 	args.getopt
> 	(
> 		"help", &help
> 	);
> }
>
> app.exe -sss
> causes crash:
> std.getopt.GetOptException at C:\D\dmd2\windows\bin\..\..\src\phobos\std\getopt.d(4
> 63): Unrecognized option -sss
> ----------------
> 0x00453F0E in @safe void 
> std.getopt.getoptImpl!().getoptImpl(ref immutable(char)
> [][], ref std.getopt.configuration) at 
> C:\D\dmd2\windows\bin\..\..\src\phobos\st
> d\getopt.d(463)

Look for "Passing unrecognized options through" in the 
documentation.



More information about the Digitalmars-d-learn mailing list