Is there a way to pass an array of ints with a command line parameter in GFlags?

528 Views Asked by At

I want to pass an array of ints in the following way:

./main --scores 1 49 1 24 4 5 6

I did find a similar question but it's sort of old, hopefully it's changed now. The accepted answer says I should pass them as string with a delimiter.

1

There are 1 best solutions below

0
Sneftel On

You can't. GFlags doesn't support complex command-line syntax, just simple flags with primitive-typed parameters. You could pass them as a delimited string, but if you really want to go all fancy with your command line usage, you'd probably be better served with a library designed for that, like GNU getopt.