[fpc-pascal] Adding file to string to the RTL

Ryan Joseph genericptr at gmail.com
Fri Oct 9 21:58:13 CEST 2020



> On Oct 9, 2020, at 7:02 AM, Benito van der Zander via fpc-pascal <fpc-pascal at lists.freepascal.org> 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



More information about the fpc-pascal mailing list