Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

c++ help using getopt i need to parse through i guess a command line arguement u

ID: 674046 • Letter: C

Question

c++ help

using getopt

i need to parse through i guess a command line arguement using getopt. how do I start?

i.e

chmod -sym MODE[,MODE]... FILE

The format of a symbolic mode is [ugoa...][[+-=][perms...]...], where perms is either zero or more letters from the set rwxXst, or a single letter from the set ugo. Multiple symbolic modes can be given, separated by commas. This format is the same as in the GNU version of the chmod utility.

i'm guessing i will have to parse throught it and code it accordingly.

Explanation / Answer

The ':' at the beginning of my string in the call to getopt() tells it to return a ':' in the event that a known parameter requires an argument. Also, I stated that "that <the desired behavior> occurs in the event that -a is the last parameter passed into the program."

If it [getopt] detects a missing option-argument, it shall return the colon character ( ':' ) if the first character of optstring was a colon, or a question-mark character ( '?' ) otherwise.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote