• HOME
  • DOCS
  • WTF
  • TECH
  • LIFE
  • PAGES
    • ARCHIVE
    • TAGS
    • ABOUT
    • FRIENDS
    • RSS
  • TOOLS
    • GEO
    • RANDOM()
    • GOO.GL
    • CSS HEART
Aj's Blog

记录时间溜走的瞬间和折腾过的那些事

wxWidgets如何解析ini配置文件

2012-09-20  TECH  ini  wxFileConfig  wxWidgets  2  

头文件
#include <wx/fileconf.h>

示例

wxString UserName;
//Load Config file
wxFileConfig *config = new wxFileConfig(
				wxEmptyString,
				wxEmptyString,wxGetCwd() + "\\conf.ini",
				wxEmptyString,
				wxCONFIG_USE_LOCAL_FILE
);
config->Read("UserName",&UserName);

在线文档:
http://docs.wxwidgets.org/2.8/wx_wxfileconfig.html

下一篇:   wxWidgets几种网络通讯方式的实现和对比: wxHTTP / wxURL / wxSocket
上一篇:   注册表修改UserAgent说明文档
  • emonkey says:
    September 30, 2012 at 22:22

    请问怎么写入、修改和添加一个key呢?

    Reply
    • Aj says:
      October 1, 2012 at 00:48

      文档里面有详细说明,仔细看看,给个粗略的demo,接上面代码

      if( config->Write( "key_test",  "val_test" ) ) //写入kv值
      {
      	config->Flush();//写入到文件
      }
      else
      {
      	wxMessageBox( "Failed to save config!" );
      }
      
      Reply
  • Cancel reply