// FirstTest.cpp : 定义控制台应用程序的入口点。
//ptree解析ini文件,get<Type>(treename, translator) :translator类型实例
#include "stdafx.h"
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/ini_parser.hpp>
#include <string>
using namespace std;
int main()
{
boost::property_tree::ptree m_pt;
string ini_file = "test.ini";
boost::property_tree::ini_parser::read_ini(ini_file, m_pt);
string path = m_pt.get<string>("LogPath","");
int maxcount = m_pt.get<int>("LogMaxCount", 1);
cout << path << "::" << maxcount<<endl;
system("pause");
return 0;
}
LogPath=/home/smc
LogMaxCount=3