VC使用tinyxml读写INI,cfg,XML配置文件
来源:互联网 发布:中世纪的生活 知乎 编辑:程序博客网 时间:2024/06/18 15:05
- #define UPDATE_CONFIG "update.cfg" //客户端版本信息文件
- //解析Update.cfg文件
TiXmlDocument UpdateCfgDoc(UPDATE_CONFIG);
if (!UpdateCfgDoc.LoadFile())
{
::MessageBox(NULL, "读取客户端版本文件失败!", NULL, MB_ICONERROR);
SwitchStateAsync(US_UpdateFailed);
return 0;
}
TiXmlElement* pConfigRoot = UpdateCfgDoc.RootElement()->FirstChildElement();
if (NULL == pConfigRoot)
{
return 0;
}
const char* szCurVer = pConfigRoot->Attribute("ClientVersion");
const char* szCurToolVer = pConfigRoot->Attribute("UpdateToolVersion");
//保存玩家当前选择服务器到配置文件
#define SERVER_CONFIG "LoginServer.cfg" //保存玩家选择的区
TiXmlDocument ServerConfigDoc(SERVER_CONFIG);
if (!ServerConfigDoc.LoadFile())
{
::MessageBox(NULL, "解析本地服务器选择配置文件失败!", NULL, MB_ICONERROR);
return;
}
CString strLoginServerName;
m_CurLoginServer.GetWindowText(strLoginServerName);
TiXmlElement* pHistoryServer = ServerConfigDoc.RootElement()->FirstChildElement();
if(pHistoryServer!=NULL)
{
if(strcmp(pHistoryServer->Value(), "server") == 0)
pHistoryServer->SetAttribute("name", strLoginServerName);
ServerConfigDoc.SaveFile();
}
else
{
TiXmlElement ele("server");
ele.SetAttribute("name",strLoginServerName);
ServerConfigDoc.RootElement()->LinkEndChild(&ele);
ServerConfigDoc.SaveFile();
}
0 0
- VC使用tinyxml读写INI,cfg,XML配置文件
- VC使用tinyxml读写INI,cfg,XML配置文件
- VC使用tinyxml读写INI,cfg,XML配置文件
- VC++读写INI配置文件
- VC ini配置文件读写
- vc读写配置文件ini
- VC++读写配置文件.ini
- vc配置文件读写(ini与xml格式)
- VC配置文件ini的读写
- VC配置文件ini的读写
- VC配置文件ini的读写
- VC配置文件ini的读写
- VC配置文件ini的读写
- c++ 使用TinyXml读写Xml
- 使用TinyXML读写xml文件
- 使用tinyxml解析XML配置文件
- Python 配置文件(.ini、 .conf、 .cfg)的读写
- 使用C#读写ini配置文件
- LL语法分析器和LR语法分析器的比较
- Hadoop大数据处理流程
- swift—2
- OCP 1Z0 052 25
- 《学习R》
- VC使用tinyxml读写INI,cfg,XML配置文件
- 一个人一生的路程
- Iterables, Iterators and Generators: Part 2
- 学生聚类分析思考
- CSS和JS链接地址中带的问号
- Hbase 绑定多网卡的问题
- Zookeeper:Timeout while waiting for epoch from quorum解决方案
- CRT detected that the application wrote to memory after end of heap buffer
- SAP 人力资源工资配置项1---工资计算周期配置