您的位置:首页 > 运维架构 > Linux

The Linux Programming Interface Appendix B Parsing Command-Line options 解析命令行中的选项

2017-03-06 11:33 555 查看
The Linux Programming Interface

Parsing Command-Line options

(01) 形式

command [ options ] arguments

An option takes the form of a hyphen (-) followed by a unique character identifying the option and a possible argument for the option.

Multiple options can be group after a single hyphen

(02) getopt() 函数

int getopt(int argc, char * const argv[], const char *optstring);

argc, argv, which would normally be taken from the arguments of the same name to main().

The optstring argument specifies the set of options that getopt() should look for in argv.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: