getopt_long函数可以轻松的解析main函数的命令行参数. int getopt_long(int argc,char * const argv[],const char *optstring,const struct option *longopts,int *longindex) 函数中的参数argc和argv通常直接从main()的两个参数传递而来.optstring是选项参数组成的字符串. 字符串optstring可以下列元素: 1. 单个字符,表示选项, 2. 单个字符后接一个…