【发布时间】:2019-04-07 15:19:28
【问题描述】:
我想完全读取 INI 文件,我正在使用 wxFileConfig 类来执行此操作,但互联网的大多数示例只是读取和写入一个项目,而不是整个 INI 文件。
INI文件中的数据类似如下:
[sdl]
fullresolution=0x0
fullscreen=true
output=opengl
autolock=false
[dosbox]
machine=svga_s3
memsize=16
[render]
frameskip=0
aspect=false
scaler=normal2x
[cpu]
core=normal
cputype=auto
cycles=10000
cycleup=1000
cycledown=1000
.....
我试图做某事,但它只是读取标题([sdl]、[dosbox]、[render]、...)。
wxFileConfig config(wxEmptyString, wxEmptyString, wxEmptyString, wxGetCwd() + "\\dosbox.conf");
wxString str;
long idx;
bool bCont = config.GetFirstGroup(str, idx);
while (bCont) {
bCont = config.GetNextGroup(str, idx);
debugMsg("%s", str);
}
如何读取每个标题及其项目?
【问题讨论】:
-
您是要获取单个标题的条目还是要分别读取所有标题和项目?
-
@DeveloperPaul:阅读所有标题和项目。