gengetopt: How to parse a string without an option (like a file name)
-
07-07-2021 - |
Pregunta
I'm trying to parse command line options using code generated by gengetopt, and I'm trying to figure out how to parse an extra argument (after all the other options) that has no long or short option.
I'd like to call it like this:
program [options] [input file]
ex: program -a -b -letterc "C:\somefile.txt" or program -a -b -letterc somefile.txt
where the option "letterc" has no arguments.
Does anyone know how to do this using gengetopt?
Solución
These should be avaiable in the inputs
member of the gengetopt_args_info
. There are input_num
of them.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow