Subject: Re: File I/O: reading from, writing to,
same file in one function One more safety feature in the "proper way": in most systems it will guarantee that a concurrent reader sees a coherent file image. ------------------------------------------------------------
I strongly urge you to use the proper way with temp file and renaming, even making it a function if you need to repeat this several times
The "proper way" is fraught with pitfalls: potentially changes in file ownership and permissions, loss of linkage when the file is known by multiple names, and even total failure if you don't have write permission on the directory.^C The proper way does have one safety advantage. The original file is highly likely to survive should the writing of the new contents stop prematurely for some external reason. Doug
participants (1)
-
Doug McIlroy