boost库之ptree的ini配置文件解析

// FirstTest.cpp : 定义控制台应用程序的入口点。
//ptree解析ini文件,get(treename, translator)  :translator类型实例
#include "stdafx.h"
#include   
#include   
#include   
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("LogPath","");
	int maxcount  = m_pt.get("LogMaxCount", 1);
	cout << path << "::"  << maxcount<
LogPath=/home/smc
LogMaxCount=3

你可能感兴趣的:(boost,C++)