On 2004.05.21, Bas Scheffers <[EMAIL PROTECTED]> wrote:
> Sounds like a job for "fconfigure" to me. Not sure though it that would
> replace the characters when using "puts" to write a string that already
> has newlines in them, or if it only does it it for the newline it
> automaticaly inserts after a puts.
I already experimented with [fconfigure] -- it won't work. It only
translates the last newline in the string. Therefore:
set f [open foo.txt w]
fconfigure $f -translation {auto,cr,crlf,lf,binary}
puts $f "abcd\r\n"
close $f
No matter what you specify for fconfigure, it only seems to translate
the line-ending that [puts] appends -- any \r or \n within the string to
[puts] itself goes through unaltered.
If you really want to mangle the data, you probably want:
regsub -all {\r} $text {} text
puts $f $text
Or whatever ...
-- Dossy
--
Dossy Shiobara mail: [EMAIL PROTECTED]
Panoptic Computer Network web: http://www.panoptic.com/
"He realized the fastest way to change is to laugh at your own
folly -- then you can let go and quickly move on." (p. 70)
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of
your email blank.