Hello guys,i created a config file and got line by line then parsed to variables.How can i set local (function) variable to global variable ? sorry for bad english.
Current code:
void GetSettings()
{
ifstream nameFileout;
nameFileout.open("Settings.conf");
string line;
if (!nameFileout.is_open())
{
exit(0);
}
while (std::getline(nameFileout, line))
{
string parse = "[Zoom]-10";
stringstream ss(parse);
string temp = "[Zoom]";
getline(ss, temp, ']');
getline(ss, temp, '[');
double Result;
stringstream convert(temp);
double Z2 = atof(temp.c_str());
AllocConsole();
freopen("CONOUT$", "w", stdout);
std::cout << line << std::endl;
}
nameFileout.close();
}
Output :
Z2 = -10