From: Gregory Brown Date: 2009-04-30T22:58:40+09:00 Subject: Re: Read and re-write file with one open? On Thu, Apr 30, 2009 at 3:11 AM, Adam Bender wrote: > I see the potential for catastrophe with the way I suggested, however, there > is potential for catastrophe here if there is already an > "origName-edited.txt" file (I know, slim chance, but you never know).  You > could get around this by generating new file names until you found one that > didn't exist, or writing to /tmp, of course.  I think I'll switch to Greg > Brown's suggestion.  Does Tempfile guarantee that it won't overwrite an > existing file? Yes, Tempfile avoids file collisions. -greg