Hi. I was just practicing what I have learned so far and ran into a problem.
In the code below, I simply need to accept either an -r or a -c flag. I don't need the -d flag or any arguments for -d.
This is the only way I know how to write this, but how would I *properly* write this for what I need?
I'm not sure I understand your question.
You only need -r or -c.
You don't need -d or any arguments for d. (So why are do you have "d:" in your getopt string?)
x = getopt (argc, argv, "rc")
Getopt does not check or enforce exclusivity. Your program should notice that and complain appropriately.