getopt使用样本/模板
来源:互联网 发布:广告优化师的工作内容 编辑:程序博客网 时间:2024/04/28 10:32
//this is the sample of use of getopt funtion#include <unistd.h>#include <stdio.h>int main(int argc, char * argv[]){ int ch; //printf("optind:%d,opterr:%d\n",optind,opterr); //printf("--------------------------\n"); //opterr = 0; while ((ch = getopt(argc, argv, "ab:e::")) != -1) { //printf("optind: %d,argc:%d,argv[%d]:%s\n", optind,argc,optind,argv[optind]); switch (ch) { case 'a': //Add your code printf("HAVE option: -a\n\n"); break; case 'b': //Add your code printf("HAVE option: -b\n"); printf("The argument of -b is %s\n\n", optarg); break; case 'e': //Add your code printf("HAVE option: -e\n"); printf("The argument of -e is %s\n\n", optarg); break; case '?': default: printf("Unknown option: %c\n",(char)optopt); printf("usage:programname [-a] [-b xxx] [-exxx] \r\n"); break; } } //printf("----------------------------\n"); //printf("optind=%d,argv[%d]=%s\n",optind,optind,argv[optind]);}
0 0
- getopt使用样本/模板
- getopt使用
- getopt 使用
- getopt使用示例
- getopt函数的使用
- getopt函数的使用
- python中使用getopt
- getopt的使用
- getopt函数的使用
- python中使用getopt
- getopt函数的使用
- getopt函数的使用
- getopt函数的使用
- MFC中使用getopt
- readlink、getopt函数使用
- getopt()的使用
- getopt使用介绍
- getopt使用方式(续)
- hdu3401 Trade 单调队列优化DP
- java---枚举
- python 遍历目录所有文件
- TCP的三次握手以及四次挥手
- P124 第44题 成绩
- getopt使用样本/模板
- n阶非奇异矩阵所构成的群的中心,是恒等矩阵的倍乘构成的集合
- P124第44题
- SGU107 987654321 problem
- P124第45题
- ubuntu 14.04没有权限登陆mysql
- Joseph环学习
- 组件、插件、控件的区别
- 使用SecureCRT在远程主机和本地之间传输文件