Em sex., 1 de ago. de 2025, 17:54, James Richters via fpc-pascal < fpc-pascal@lists.freepascal.org> escreveu:
> Thank you for the great suggestions! I did not know I could have a > memory version of the ini file. > that sounds like a better solution than what I am doing. Right now I am > reading in all the ini settings and putting them into variables like > Ini_myvariable > > then I use those as needed.. then write them all out, but if I am > understanding it correctly could I just use the memory version of the ini > file directly? > > It seems like that would be much easier and also solve the issues. > > James > https://github.com/fpc/FPCSource/blob/main/packages/fcl-base/src/inifiles.pp To try to resolve your issue you should use TMemIniFile and invoke Rename() before freeing the TMemIniFile (or invoking UpdateFile explicitly) to save to the temporary file. TMemIniFile is just TIniFile with some extra methods and with CacheUpdates defaulting to True. They parse the whole ini file in the constructor, so values are always read from memory. Regards, Flávio P.S. Although these classes are meant for compatibility with Delphi/Windows, maybe they should provide extra methods with correct exception handling and "atomic" saving with temporary file? Or maybe someone can recommend alternatives? >
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal