#include <iostream>
#include <fstream>
#include <cassert>
#include <string>
#include <iostream>
#include <vector>
#include <map>
using namespace std;
const string fileName = "config.txt";
map<string, string> tar_path;
int main()
{
ifstream fin;
fin.open(fileName);
if (false == fin.is_open()) {
std::cerr << "open file failed!!" << std::endl;
return -1;
}
string s;
while (getline(fin, s))
{
size_t pos= s.find_first_of("=");
if (pos == std::string::npos || pos+1>=s.size())
continue;
string targetName = s.substr(0,pos-1);
string path = s.substr(pos+1);
std::cout << targetName << " = " << path << std::endl;
}
fin.close();
//================================================
return 0;
}
解析文本为 XXXX=E: est1234