0

I want to create a programme that will have mandatory option and optional option.

Mandatory:

  • -d <device>

Optional:

  • -h : help
  • -m <value> : launch an internal function with the value of the argument.
  • ... (other optional option with or without argument).

I see how manage only optional option but how to cohabitate the mandatory and optional?

Other info: the mandatory option will give the information on what /dev/video# to open and needs to be done before parsing the optional options where functions will be called that need to have the file descriptor already opened.

I tried to manage it with getopt() but I did not see how to manage both mandatory and optional options.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
eone
  • 1

0 Answers0