建立参数对应关系的小程序
来源:互联网 发布:黑桐谷嫂的淘宝店 编辑:程序博客网 时间:2024/04/28 17:29
/* * testparameter.c * * Created on: 2013-7-10 * Author: Administrator */#include <stdlib.h>#include <string.h>#include <stdio.h>#include "testparameter.h"static const struct paramater_table paramaters_table[] = { { "a", "apple" }, {"b", "boy" }, { "c", "cat" }, { "d", "dog" } };void usage(void) {fprintf(stderr, "usage: testparameter name\n");exit(0);}void search_parameter(char * fixed_name) {int i = 0;int ret_cmp = 0; for (i = (sizeof(paramaters_table) / sizeof(paramaters_table[0])) - 1; i >= 0; i--){printf("**%d,%s**\n",i,paramaters_table[i].trname);ret_cmp = strcasecmp(fixed_name, paramaters_table[i].trname);if (ret_cmp == 0) {printf("get the name %s\n", paramaters_table[i].wifiname);return;}}}int main(int argc, char **argv) {if (argc != 2) {usage();}search_parameter(argv[1]);}
/* * testparameter.h * * Created on: 2013-7-10 * Author: Administrator */#ifndef TESTPARAMETER_H_#define TESTPARAMETER_H_/*tr and wifi parameter table*/struct paramater_table {const char *trname;const char *wifiname;};#endif /* TESTPARAMETER_H_ */
编译: gcc -o test testparameter.c testparameter.h
执行 : ./test 字符串参数
- 建立参数对应关系的小程序
- 女人与程序的对应关系!
- 建立重叠摄像头之间的视点对应关系
- socket 建立连接与三次握手的对应关系
- git建立追踪关系的小技巧
- 一个取得对应时间的小程序
- 小提示:查找TextFormat 中文参数对应的英文名称
- extjs 日期格式化参数对应关系
- 相关参数--与GrounTruth对应关系
- x264命令参数与代码对应关系
- OpenGL中glVertex2f函数与gluOrtho2D的参数的对应关系,以及常见函数的对应坐标系
- OpenGL中glVertex2f函数与gluOrtho2D的参数的对应关系,以及常见函数的对应坐标系
- OpenGL中glVertex2f函数与gluOrtho2D的参数的对应关系,以及常见函数的对应坐标系
- 函数的参数对应
- Delphi的参数修饰const/var/output 与C++的对应关系
- 一个基于对话框的程序添加了许多控件,但是无法建立对应的成员变量
- PB5.0 features/sysgen参数和ceconfig.h中宏定义的对应关系
- PB5.0 features/sysgen参数和ceconfig.h中宏定义的对应关系
- C# Winform 支持Hex与ASCII输入和切换的文本框
- 守护进程与setsid
- Struts1 jar 包说明
- 大话设计模式笔记
- DWZ 表单提交重定向问题
- 建立参数对应关系的小程序
- Linux下Android ADB驱动安装详解
- Eclipse console 中文乱码解决
- 面向对象之构造函数和析构函数之五
- IOS开发UI展示之UITableView ──分页加载更多
- jBPM开发入门指南(1)
- linux等待队列 第四篇
- hdu 4003 Find Metal Mineral
- centos下安装libevent