读写ini
来源:互联网 发布:淘宝挤爆了 编辑:程序博客网 时间:2024/05/16 01:30
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/ini_parser.hpp>
#include <boost/program_options/detail/convert.hpp>
#include <boost/program_options/detail/utf8_codecvt_facet.hpp>
//#ifndef _UNICODE
// #define Category std::locale::category()
// #define Tptree boost::property_tree::ptree
// #define StringType std::string
//#else
#define Category program_options::detail::utf8_codecvt_facet()
#define Tptree boost::property_tree::wptree
#define StringType std::wstring
//#endif
//#define BOOST_ALL_DYN_LINK
using namespace std;
using namespace boost;
using namespace boost::property_tree;
int main()
{
locale current_locale(locale(""),new Category);
Tptree pt;
boost::property_tree::ini_parser::read_ini("test.ini",pt,current_locale);
StringType str = pt.get<StringType>(_T("BaseInfo.NotationProgram"));
int AutoFocus = pt.get<int>(_T("BaseInfo.AutoFocus"));
pt.put<StringType>(_T("zhou.qing"),_T("好的"));
boost::property_tree::ini_parser::write_ini("test.ini",pt,0,current_locale);
TCHAR szData[50];
_tcscpy(szData,str.c_str());
std::system("pause");
return 0;
}
#include <boost/property_tree/ini_parser.hpp>
#include <boost/program_options/detail/convert.hpp>
#include <boost/program_options/detail/utf8_codecvt_facet.hpp>
//#ifndef _UNICODE
// #define Category std::locale::category()
// #define Tptree boost::property_tree::ptree
// #define StringType std::string
//#else
#define Category program_options::detail::utf8_codecvt_facet()
#define Tptree boost::property_tree::wptree
#define StringType std::wstring
//#endif
//#define BOOST_ALL_DYN_LINK
using namespace std;
using namespace boost;
using namespace boost::property_tree;
int main()
{
locale current_locale(locale(""),new Category);
Tptree pt;
boost::property_tree::ini_parser::read_ini("test.ini",pt,current_locale);
StringType str = pt.get<StringType>(_T("BaseInfo.NotationProgram"));
int AutoFocus = pt.get<int>(_T("BaseInfo.AutoFocus"));
pt.put<StringType>(_T("zhou.qing"),_T("好的"));
boost::property_tree::ini_parser::write_ini("test.ini",pt,0,current_locale);
TCHAR szData[50];
_tcscpy(szData,str.c_str());
std::system("pause");
return 0;
}
0 0
- 读写INI
- 读写Ini
- 读写ini
- 读写INI
- 读写ini
- 读写ini
- 读写ini
- ini读写
- 读写INI
- C#读写INI文件
- INI的读写
- INI文件的读写
- C#读写INI文件
- C#读写INI文件
- C#读写INI文件
- 读写INI文件
- 如何读写INI 文件
- 读写INI文件
- 黑马程序员----集合框架
- LeetCode 3 Longest Substring Without Repeating Characters
- 用记事本编写app接口,sqllite数据库操作
- MFC中在基于对话框的窗体中使用CFileDialog导致菜单栏变灰的解决方案
- spring security与cas 集成(中)续
- 读写ini
- android browser独立应用编译
- C++笔记 第一讲
- lightOJ 1214 Large Division
- 深入了解 CSS3 新特性
- Java泛型方法定义及泛型类型推断
- 避免创建不必要的对象
- HDU ACM 1873 看病要排队->优先队列
- convert utc time to local time in excel