getopt函数的使用
来源:互联网 发布:php大型网站如何维护 编辑:程序博客网 时间:2024/04/29 08:36
#include <stdio.h>
#include <getopt.h>
#include <getopt.h>
int main(int argc, char *argv[])
{
int ch, aflag = 0, lflag = 0, i;
{
int ch, aflag = 0, lflag = 0, i;
while ((ch = getopt(argc, argv, "al")) != -1)
{
switch ( ch )
{
case 'a':
printf("set option -a\n");
aflag = 1;
break;
case 'l':
printf("set option -l\n");
lflag = 1;
break;
default:
printf("wrong option %c\n", ch);
}
}
{
switch ( ch )
{
case 'a':
printf("set option -a\n");
aflag = 1;
break;
case 'l':
printf("set option -l\n");
lflag = 1;
break;
default:
printf("wrong option %c\n", ch);
}
}
for (i=optind; i<argc; i++)
{
printf("%s ", argv[i]);
}
printf("\n");
printf("optind = %d\n", optind);
{
printf("%s ", argv[i]);
}
printf("\n");
printf("optind = %d\n", optind);
return 0;
}
}
- getopt函数的使用
- getopt函数的使用
- getopt函数的使用
- getopt函数的使用
- getopt函数的使用
- getopt函数的使用
- getopt()函数的使用
- getopt函数的使用
- getopt函数的使用
- getopt函数的使用
- getopt函数的使用
- getopt函数的使用
- getopt函数的使用
- getopt函数的使用
- 函数getopt的使用
- getopt()函数的使用
- getopt函数的使用
- getopt函数的使用
- 图的存储—链表
- 利用图求最短路径
- 快速排序实现
- 学习使用linux下tags文件
- 标准IO的函数分析
- getopt函数的使用
- 用文件IO操作实现ls命令
- 基于UDP套接字的局域网聊天室
- 基于TCP协议select多路复用-1
- 基于TCP协议select多路复用-2
- 利用setsockopt实现超时检测
- 自己写ping的实现
- linux系统定制(二)
- 实现简单的hello翻译