/******************main.c*******************/
#define _CRT_SECIRE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"CfgFile.h"
void menu()
{
printf("========================\n");
printf("1:查看配置文件;\n");
printf("2:修改配置文件;\n");
printf("3:清除屏幕;\n");
printf("4:退出。\n");
printf("========================\n");
}
void MyRead()
{
char key[128] = { 0 };
char value[128] = { 0 };
int valuelen = 0;
int ret = 0;
printf("请输入查找的key值:");
scanf("%s", key);
ret = ReadCfgFile(CfgFileName, key, value, &valuelen);
if (ret != 0)
{
printf("读取%s的值失败\n", key);
return;
}
printf("读取key:%s, value:%s, valuelen:%d\n", key, value, valuelen);
}
void MyWrite()
{
char key[128] = { 0 };
char value[128] = { 0 };
//int valuelen = 0;
int ret = 0;
printf("请输入待写入的key值:");
scanf("%s", key);
printf("请输入待写入的value值:");
scanf("%s", value);
ret = WriteCfgFile(CfgFileName, key, value);
if (ret != 0)
{
printf("写入key:%s,value:%s,失败\n", key,value);
return ;
}
printf("写入key:%s,value:%s,成功\n", key, value