【文件属性】:
文件名称:C++中操作Ini文件的源代码
文件大小:15KB
文件格式:RAR
更新时间:2023-04-28 10:08:34
cini cini源代码
C/C++中ini的代码。以下是我代码中使用ini的一个函数,揣摩一哈,百度上搜一下关于ini的那几个函数的用法就差不多了:
#include "CIni/iniparser.h"
……
void CDoFile::GetSupportPluginList(std::vector> &SupportPluginList)
{
dictionary *ini;
int n = 0;
char *str;
char *secName;
char confname[256] = "name";
char confdllname[256] = "dllname";
char **pKeys = NULL;
wstring inipath;
WCHAR szCurDir[1024] = { 0 };
GetCurrentDirectory(1024, szCurDir);
//inipath = szCurDir;
GetMoudlePath(inipath);
inipath += L"\\plugin.ini";
ini = iniparser_load(CDoString::WideStrToMultiStr(inipath.c_str()));
if (ini == NULL)return;
dictionary *dic = NULL;
int nSecCount = iniparser_getnsec(ini);
for (int i = 0; i < nSecCount xss=removed xss=removed> vTmp;
vTmp.clear();
int nCount = iniparser_getsecnkeys(ini, secName);
pKeys = iniparser_getseckeys(ini, secName);
char *pTmp = *pKeys;
for (int j = 0; j < nCount; j++) {
str = iniparser_getstring(ini, pTmp,NULL);
vTmp.push_back(str);
pKeys++;
pTmp = *pKeys;
}
SupportPluginList.push_back(vTmp);
//}
}
}
【文件预览】:
CIni
----dictionary.h(5KB)
----dictionary.c(10KB)
----iniparser.h(11KB)
----iniparser.c(20KB)
----Ini.cpp(14KB)
----Ini.h(1KB)