命令行参数命令行参数的分析.pdfVIP

  • 2
  • 0
  • 约3.67千字
  • 约 5页
  • 2017-08-31 发布于重庆
  • 举报
命令行参数命令行参数的分析.pdf

命令行参数:命令行参数的分析 疯狂代码 http://CrazyC/ ĵ http:/CrazyC/VC/Article13842.html 在实际程序之中我们经常要对命令行参数进行分析. 比如我们有一个程序a可以接受许多参数.一个可能的 情况是 a -d print --option1 hello --option2 world 那么我们如何对这个命令的参数进行分析了?.经常用函数是getopt和getopt_long. #include unistd.h #include getopt.h int getopt(int argc,char const **argv, const char *optstring); int getopt_long(int argc,char const **argc, const char *optstring,const struct option *longopts, int *longindex); extern char *optarg; extern int optind,opterr,optopt; struct option { char *name; int has_fl

文档评论(0)

1亿VIP精品文档

相关文档