I am working on a c project, which I am trying to write a program that allows users to use one of the command line options to invoke the program. For example
./program [-a or -b or -c] [-f filename] [-l length]
Which [-a or -b or -c] is compulsory, and -f and -l is not.
My question is, how to return an error if users choose any two or more of the [-a or -b or -c] at the same time?
This is allowed
./program -a -f -l
But not
./program -a -b -f -l
My thought is to use getopt() to verify the options, but I am not sure how to do this.
Thank you for your time! Sorry if I ask something stupid.