开发者

Purpose for OptionArg

开发者 https://www.devze.com 2023-02-07 15:58 出处:网络
What is the purpose for OptionArg. Please provide documentation for the same. And what does the following 开发者_开发技巧code signify:

What is the purpose for OptionArg.

Please provide documentation for the same.

And what does the following 开发者_开发技巧code signify:

const OptionEntry[] options = {
    {"wide",    'w', 0, OptionArg.NONE,     ref wide,    N_("Enable wide mode"),                    null        },
    {"device",  'd', 0, OptionArg.FILENAME, ref device,  N_("Device to use as a camera"),           N_("DEVICE")},
    {"version", 'v', 0, OptionArg.NONE,     ref version, N_("Output version information and exit"), null        },
    {null}
  };

Regards, iSight


OptionEntry might be this...

You maybe have a program that can be launched from a command line, and you have several options and arguments that can be given.

Maybe -h or --help gives you help info, while -C 2 or --context=2 gives you two lines of context in the response, while -hl="red" or --highlight="red" gives you red highlighting. For each of those, you have to do several things in the code: (1) define the short flags (2) the long flags and (3) the action to be done. So this is an array of options and the actions and types or whatever.

0

精彩评论

暂无评论...
验证码 换一张
取 消