Where does getopt_long store an unrecognized option?

Posted by Rob Kennedy on Stack Overflow See other posts from Stack Overflow or by Rob Kennedy
Published on 2010-04-27T18:25:43Z Indexed on 2010/04/27 21:33 UTC
Read the original article Hit count: 161

Filed under:
|

When getopt or getopt_long encounters an illegal option, it stores the offending option character in optopt. When the illegal option is a long option, where can I find out what the option was? And does anything meaningful get stored in optopt then?

I've set opterr = 0 to suppress the automatically printed error message. I want to create my own message that I can print or log where I'd like, but I want to include the name of the unrecognized option.

© Stack Overflow or respective owner

Related posts about c

    Related posts about getopt-long