标签:
#include <stdio.h> #include <unistd.h> int main(int argc, int *argv[]) { int ch; opterr = 0; while ((ch = getopt(argc,(char* const*)argv,"a:b::cde"))!=-1) { switch(ch) { case ‘a‘: printf("option a:‘%s‘\n",optarg); break; case ‘b‘: printf("option b :b\n"); break; default: printf("other option :%c\n",ch); } } printf("optopt +%c\n",optopt); }
标签:
原文地址:http://www.cnblogs.com/kaishan1990/p/5085109.html