Siema robię konfigurator najprostrzej wersji, ale w wersji konsolowej działa, a w WinApi nie za bardzo.
string config::getValues(string k)
{
file.open("config.ini", ios::in | ios::out);
vector<string> line;
string buff;
while (!file.eof())
{
getline(file, buff);
line.push_back(buff);
}
if (line.size() > 0)
{
for (int i = 0; i < line.size(); i++)
{
if (line[i].find(k) != std::string::npos)
{
buff = line[i].erase(0, line[i].find('=') + 1);
for (int j = 0; j < line[i].length(); j++)
while (isspace(line[i][j]))
{
buff.erase(j, j + 1);
}
return buff;
}
else return "Error: Nothing find";
}
}
else return "Error: Buffer is empty";
file.close();
}
Wywołanie też nie jest skomplikowane
config* conf = new config();
/*Email* forMe = new Email(
base64_decode(conf->getValues("EmailLogin")),
base64_decode(conf->getValues("EmailPassword")),
base64_decode(conf->getValues("EmailServer"))
);