[fpc-pascal] fpc-pascal Digest, Vol 254, Issue 3
Flávio Etrusco
flavio.etrusco at gmail.com
Sat Aug 2 19:54:12 CEST 2025
Em sáb., 2 de ago. de 2025 às 11:19, Rafael Picanço via fpc-pascal <
fpc-pascal at lists.freepascal.org> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20250802/e96afb21/attachment.htm>
More information about the fpc-pascal
mailing list