On Tue, May 19, 2009 at 12:29 AM, Tyler Laing <trinio...@gmail.com> wrote:

> Ahem: http://blue.bikeshed.com/
>
> There's no need for everyone to jump in and start offering solutions to a
> simple problem. There's lots of different ways to solve it. People have
> different opinions on what is the best way. But irregardless, I'm pretty
> sure the GP knows how to do it now.
>
> -Tyler
>
>
... except if the offered solutions are wrong, or there is a better way that
people might be interested in, or people just want to have a discussion in a
place where they can talk about whatever they want to.

The replace(..., "\t") solutions insert tabs, not replace tabs with spaces.
So they're not good.

Should write the result to a temporary file, then do a move from the
temporary file into the new file.  This way if there is a bug in your code
half way through writing it won't wipe out the original...  Also move is an
atomic operation, whereas writing to the file you just read from can cause
all sorts of problems.  Say something tries to read your file halfway
through your write, then they will get half a file back... whereas if you
write to a temporary file then move it, every other program reading your
file will never get a corrupt file.


cu,

Reply via email to