i'm certain the INI is in the same directory i tested this EXE and INI on a separate computer too
I replaced the code with the code from the example but i Cant compile it
1 2
[C++Error] Unit1.cpp(30): Cannot convert 'System::AnsiString' to 'int'.
[C++Error] Unit1.cpp(30): Type mismatch in parameter 'Value' in call to '_fastcall Inifiles::TCustomIniFile::WriteInteger(const System::AnsiString,const System::AnsiString,int)'.
added to unit1.h
1 2
AnsiString Write;
AnsiString Read;
this is the code that the example intended to prevent this, and i put it between private: and public: as shown
I tried playing around with things in different versions of C++Builder
To be sure it was reading the right file I gave mine a different name, "My_test.ini".
To make testing easier, I added a ListBox to the form.
Then in the Form loading, added code to read either the sections, or the list of items in that section. Then I discovered I had to change the filename. I put a "./" in front of the name, to tell it to start from the current directory.
I also added code for each button separately. Then it seemed to work.
Edit1 -> Text = StartUp->ReadInteger("MyData", "Read", "");
If you want to read an integer you can't supply a string as default value.
StartUp->WriteInteger("MyData", "Write", Edit1->Text);
If you want to write an integer you can't use a string. C++Builder is not so smart to convert a string to an int.