Is there a function or unit like TIniFiles that will not be saved in the file?

I have a project that uses Inifile to read data configuration.
I decided to save the resource configuration.

I would like to ask if there is a unit or function that is the same as Tinfile or related, that saving the data configuration is optional.

any suggestions besides extracting?

thanks.

+6
source share
3 answers

TMemIniFile is what you need and should always be preferred over TIniFile. You choose whether or not to save the file.

What you cannot do directly is to initialize it from the resource, but it is not difficult to assemble it yourself.

  • Use the resource stream to retrieve your resource.
  • Create a list of strings and call loading the resource stream into the list of strings.
  • Create a TMemIniFile and call SetStrings, passing a list of strings.
+13
source

There is a class called TMemIniFile that saves changes only when you call UpdateFile . Is this good enough for you?

+8
source

TMemIniFile (a descendant of TCustomIniFile) will not be saved unless you tell it to UpdateFile;

+7
source

Source: https://habr.com/ru/post/897881/


All Articles