From: Donal K. F. <don...@ma...> - 2004-06-28 08:50:22
|
Tom Krehbiel wrote: > I'm not a deep thinker like Don, but I did wonder what the truncate > command accomplish that isn't provided by seek. My understanding is that > moving the current access position to a new location in the file will > cause the file to be truncated when it is closed. I hate to do this, but you're wrong. My evidence is the following log from a tclsh session (on WinXP, but I think all tclsh instances behave the same way): % set f [open wibble.txt w] fileb01950 % puts $f "foobar" % close $f % type wibble.txt foobar % set f [open wibble.txt r+] fileb0e648 % seek $f 3 % puts $f "" % close $f % type wibble.txt foo r Donal. |