exit
2015-08-11 10:32
309 查看
#define _CRT_SECURE_NO_WARNINGS #include <stdlib.h> #include <string.h> #include <stdio.h> #include "cfg_op.h" #define CFGNAME "c:/mycfg.ini" void mymenu() { printf("=============================\n"); printf("1 测试写配置文件\n"); printf("2 测试读配置文件\n"); printf("0 退出\n"); printf("=============================\n"); } //获取配置项 int TGetCfg() { int ret = 0; //读配置项 char name[1024] = {0}; char valude[1024] = {0}; int vlen = 0; printf("\n请键入key:"); scanf("%s", name); ret = GetCfgItem(CFGNAME /*in*/, name /*in*/, valude/*in*/, &vlen); if (ret != 0) { printf("func WriteCfgItem err:%d \n", ret); return ret; } printf("valude:%s \n", valude); } //写配置项 int TWriteCfg() { int ret = 0; //写配置项 char name[1024] = {0}; char valude[1024] = {0}; printf("\n请键入key:"); scanf("%s", name); printf("\n请键入valude:"); scanf("%s", valude); ret = WriteCfgItem(CFGNAME /*in*/, name /*in*/, valude/*in*/,strlen(valude) /*in*/); if (ret != 0) { printf("func WriteCfgItem err:%d \n", ret); return ret; } printf("你的输入是:%s = %s \n", name , valude); return ret; } void main() { int choice; for (;;) { //显示一个菜单 mymenu(); scanf("%d", &choice); switch (choice) { case 1: //写配置项 TWriteCfg(); break; case 2: TGetCfg(); //读配置项 break; case 0: exit(0); default:; exit(0); } } printf("hello...\n"); system("pause"); return ; }
相关文章推荐
- 数组
- [转]iOS UILabel自定义行间距时获取高度
- 并查集(转)
- layoutSubViews调用时机(转载的基础上添加一些自己的总结)
- struts2常用的Constant总结
- web之HTML详解
- Ext 动态添加grid 列数
- hdoj 1233 还是畅通工程【最小生成树 kruskal && prim】
- 深入Spring IOC源码之Resource
- [leetcode-100]Same Tree(C)
- android获取设备屏幕大小的方法
- 20-07-其他对象API(Date类-练习)
- 用c#编写爬虫在marinetraffic下载船只图片
- 设计模式之抽象工厂模式
- PHP面向对象(OOP):PHP5接口技术(interface)
- 转正申请书,要如何写啊?
- eclipse向mysql插入中文乱码问题
- 骆驼命名法转小写分隔
- 日经社説 20150811 御巣鷹30年を機に空の安全を高めたい
- 选择彼此间可协调工作的框架