|
From: | Thomas Christian Chust |
Subject: | Re: [Chicken-users] Portably overwriting files |
Date: | Sun, 24 Feb 2008 17:49:46 +0100 |
User-agent: | Thunderbird 2.0.0.9 (Macintosh/20071031) |
Matt Gushee schrieb:
[...] it appears that for all the R5RS I/O procedures, the behavioris unspecified whenever you open an output port on an existing file. So, do I need to explicitly delete the existing file in order tohave portable code?
Hello, the best solution would probably be to: - Write the new data to a new file in the same directory as the old one. The name of the new file could be randomly generated. - Replace the old file by renaming the new one to the old name.As the rename operation between files in the same directory is usually atomic, this has the advantage of having transactional semantics.
cu, Thomas
[Prev in Thread] | Current Thread | [Next in Thread] |