标签:查找 读取 chinese map classname string info insert size_t
配置文件格式为:
代码:
ClassName::ChineseName()
{
ifstream configFile;
string filePath = "填写配置文档地址";
configFile.open(filePath.c_str());
string strLine;
if (configFile.is_open())
{
while (!configFile.eof())
{
configFile >> strLine;
size_t pos = strLine.find("=");//查找位置标签"="
string key = strLine.substr(0, pos);//等于号左边为关键字
string value = strLine.substr(pos + 1);//右边为值
m_content.insert(pair<string, string>(key, value));//m_content为map容器
}
}
}
标签:查找 读取 chinese map classname string info insert size_t
原文地址:https://www.cnblogs.com/xubaonxopen/p/14072300.html