Re: fpc-pascal Digest, Vol 254, Issue 3
Flávio Etrusco via fpc-pascal <[email protected]>
| Newsgroups | gmane.comp.compilers.free-pascal.general |
|---|---|
| Message-ID | <CAJvBmOZVF-NKJSuwopCuJOecuLT8rri7DggHeUi+Qx7hgE3bow@mail.gmail.com> |
Em sáb., 2 de ago. de 2025 às 11:19, Rafael Picanço via fpc-pascal < [email protected]> escreveu: > Flavio, thanks for that! > > However, TMemIniFile.Rename cleans up its content with FStream := nil (Am > I correct?). So, In my case I would need to adapt it further so that: > > procedure ArchiveIniFileTo(AMemIniFile: TMemIniFile; ADestination : > string); > var > TemporaryDestination : string; > begin > TemporaryDestination := AMemIniFile.Filename; > AMemIniFile.RenameAndNothingElse(ADestination); > AMemIniFile.UpdateFile; // Flush data to disc > AMemIniFile.RenameAndNothingElse(TemporaryDestination); > end; > > Best, > Rafael Picanço > No, Rename() doesn't cleanup the contents. FStream is only stored (if you load/initialize the TIniFile/TMemIniFile from a stream) so that UpdateFile() can update/overwrite that stream with the new ini values. When loading from a stream, TIniFile/TMemIniFile read all values inside its constructor, just like when loading from a file. -Flávio _______________________________________________ fpc-pascal maillist - [email protected] https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal