Does anyone have a modern, up to date, example on how to read command line args with a /K/M switch? As in: argTemplate="PATH/K/M,ICONIFY/S";
I guess the use of the PATH is optional.
My code works just fine for PATH/K, but throw in the /M and all the text is garbled. I imagine there is a sub-array for the /M items???
And how is arg 0 the name of the program?
Yes, you're right seems it returns an array. SDK's ReadArgs autodoc:
/M - Multiple strings. This means the argument will take any number
of strings, returning them as an array of strings. Any arguments
not considered to be part of another option will be added to
this option. Only one /M should be specified in a template.
for a template "Dir/M,All/S" the command-line "foo bar all qwe"
will set the boolean "all", and return an array consisting of
"foo", "bar", and "qwe" The entry in the array will be a pointer
to an array of string pointers, the last of which will be NULL.
There is an interaction between /M parameters and /A parameters.
If there are unfilled /A parameters after parsing, it will grab
strings from the end of a previous /M parameter list to fill the
/A's. This is used for things like Copy ("From/A/M,To/A").
xadmaster lib has and example using 'FROM/A/M', maybe ot helps you somehow (see GetNames() function at bottom of source code and/or search for 'from' variable part of 'struct Args').
None of the examples I found had everything I needed. I took bits and pieces from 3 places and merged into my code.
The "/K" specifies it as a keyword. So in your case "PATH=Here:" will specifically tell it. But "Here" will work just as well if the template is clear enough for the parser. It is optional unless you see "/A" meaning it its required.
Now if you attach "/M" on the end for multiple then you should make it the last argument on the template. Otherwise it gets confusing. So the "ICONIFY/S" should be up front.
As to the arg 0, being the name of the program, I'm only aware of that happening when you use the argv from the main() function. Which doesn't relate to ReadArgs().