开发者

How can I print multiple values of the same key from SimpleIni

开发者 https://www.devze.com 2023-01-29 04:24 出处:网络
The ini file: user = abc user = def user = ghi user = xyz 开发者_开发技巧 The code: CSimpleIniCaseW ini;

The ini file:

user = abc
user = def
user = ghi
user = xyz
开发者_开发技巧

The code:

CSimpleIniCaseW ini;
ini.SetUnicode();
ini.LoadFile("myapp.ini");

CSimpleIniCaseW::TNamesDepend values;
ini.GetAllValues(L"", L"user", values);
values.sort(CSimpleIniCaseW::Entry::LoadOrder());

CSimpleIniCaseW::TNamesDepend::const_iterator i;

for (i = values.begin(); i != values.end(); ++i)
   std::wcout << i->pItem << L"\n";

It prints only xyz. How do I get the other values? I need to insert them into a vector before passing it to another function.


You have to enable multi-key first.

http://code.jellycan.com/simpleini-doc/html/class_c_simple_ini_templ.html#c3cfaf072a64f960bdcb7ddf2edc52b6

CSimpleIniCaseW ini;
ini.SetUnicode();
ini.SetMultiKey()
...
0

精彩评论

暂无评论...
验证码 换一张
取 消