http://www.purl.org/tcl/home/man/tcl8.4/TclCmd/tell.htm ---- '''tell and flush''' If you are using tell and you do reads and writes in between your calls to tell, you usually will have to do a flush or your tell will fail with a -1 return value. This is because the Tcl Channel code cannot ensure an accurate 'tell' value until you flush out pending i/o on your open channel. -mikeH Clif was nice enough to type an example of this -1 return value behaviour for tell in the Tcl'ers chat. It's included below: % set f [open tst.dat w+] file4 % tell $f 0 % puts $f "a" % tell $f 2 % seek $f 0 % read $f 1 a % tell $f 1 % puts $f bb % tell $f -1 ---- '''tell and open using "a", "a+", APPEND , etc..''' If you are using tell in combination with a channel opened via APPEND (et. al), keep in mind that for each write performed, your file position is going to be placed at the end of the file. Tcl Channels are reflecting C library behaviour in this respect (and rightly so if you think about it for a bit). -mikeH ''need some examples of this behaviour here...'' ---- One interesting use for tell is to constrain the size of output files. One might have proc constrained_log {log_fp message} { set current_size [tell $log_fp] if {expr {current_size + [string length $message] > $::log_limit}} { error "It's gotten too big ..." } else { puts $log_fp $message } ... } ---- [Tcl syntax help] - [Arts and crafts of Tcl-Tk programming] - [Category Command]