> On Oct 9, 2020, at 7:02 AM, Benito van der Zander via fpc-pascal
> <[email protected]> wrote:
>
> Writing a file should write the data in a temporary file and then rename the
> temporary file to replace the target file. Otherwise it might destroy the
> target file, without writing the new content, when there is an error.
> Although not even renaming is always safe, some people say you need a
> filesystem-specific transaction log.
I've seen in some API's they have an "atomic" flag for write file functions
which do the swap you're describing. I agree it's a smart thing to include in
the function but it's best to be an option since there is an additional
operation being performed and affects performance.
Regards,
Ryan Joseph
_______________________________________________
fpc-pascal maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal