I need to use two args with a parameter. But if I use the two args grouped then I want to enter the parameter only 1 time.
For example
./mycode -a 45
./mycode -b 45
./mycode -ab 45
I need to use two args with a parameter. But if I use the two args grouped then I want to enter the parameter only 1 time.
For example
./mycode -a 45
./mycode -b 45
./mycode -ab 45
As barmar commented,. getopt doesn't support this. It's one of those things "Wouldn't that be cool?" but do it 'by hand' in C is your only option. Not worth it IMHO. Here's a link to a longer S.O. thread describing your options for option processing: