0

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
Barmar
  • 669,327
  • 51
  • 454
  • 560
Mauro
  • 3
  • 2

1 Answers1

2

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:

Leonard
  • 12,882
  • 8
  • 44
  • 71