宿迁做网站 宿迁网站建设,江西九江刚刚发生的新闻,建设银行官方网站认证,建立英文翻译在网上找了一下#xff0c;发现并没有很多关于这个小型头文件的资料
只好自己上了
int main(int argc, const char * argv[]) {ezOptionParser opt;opt.overview Demo of parsers features.; //概要说明,一般需要填写#xff0c;简要介绍程序的作用opt.synta…在网上找了一下发现并没有很多关于这个小型头文件的资料
只好自己上了
int main(int argc, const char * argv[]) {ezOptionParser opt;opt.overview Demo of parsers features.; //概要说明,一般需要填写简要介绍程序的作用opt.syntax complete first second [OPTIONS] in1 [... inN] out;opt.example complete a b -f --list 1,2,3 --list 4,5,6,7,8 -s string -int -2147483648,2147483647 -ulong 9223372036854775807 -float 3.40282e038 -double 1.79769e308 f1 f2 f3 f4 f5 f6 fout\n\n; //示例opt.footer ezOptionParser 0.1.4 Copyright (C) 2011 Remik Ziemlinski\nThis program is free and without warranty.\n; //脚注,可以不填,一般可以在其中包含版权,开源协议等信息opt.add(, // Default. //默认参数可以为空0, // Required? //是否必须填写参数0则不需要直接 -h0, // Number of args expected. //期望的参数数量 0表示不带参数,-1表示任意多个,1表示一个,2表示两个,以此类推0, // Delimiter if expecting multiple args. //若输入多个参数规定参数之间的分隔符Display usage instructions., // Help description. //对该选项的解释-h, // Flag token. //定义多个该选项-help, // Flag token.--help, // Flag token.--usage // Flag token.);
}// 解析命令行参数opt.parse(argc, argv);// 检查是否设置了帮助选项//isSet判断是否包含了某个选项if (opt.isSet(-h) || opt.isSet(--help)) {std::string usage;opt.getUsage(usage);std::cout usage;return 0;}// 获取参数值std::string inputFile;if (opt.get(-f)-isSet)opt.get(-f)-getString(inputFile);
官方链接
ezOptionParser download | SourceForge.net
GitHub - seanmiddleditch/ezoptionparser: http://sourceforge.net/projects/ezoptionparser/