Getting values from ini file
Last edited on
How do I make it so that it can read that integer |
Try this to load it from the file:
1 2 3 4 5 6
|
CIniReader reader("Yourfilename");
int X = reader.ReadInteger("TPCoordinate", "TP1_X", -1 );
if (X != -1) // value was there
// use X
|
and then put it into a form textbox? I'm using a button to load those coordinates into a textbox. |
This depends what are you using - C++/CLI or Win API or...
It turns out, it was working, but my file path was wrong.
1 2 3 4 5 6 7 8 9 10 11
|
CIniReader iniReader(".\\settings.ini");
CIniWriter iniWriter(".\\settings.ini");
if (dwTPC == 1)
{
this->TP1_X->Text = iniReader.ReadInteger("TPCoordinate", "TP1_X", 0).ToString();
this->TP1_Y->Text = iniReader.ReadInteger("TPCoordinate", "TP1_Y", 0).ToString();
this->TP2_X->Text = iniReader.ReadInteger("TPCoordinate", "TP2_X", 0).ToString();
this->TP2_Y->Text = iniReader.ReadInteger("TPCoordinate", "TP2_Y", 0).ToString();
}
|
Topic archived. No new replies allowed.