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

来源:互联网 发布:手机网页京东淘宝广告 编辑:程序博客网 时间:2024/04/28 12:32

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.


0 0
原创粉丝点击