#make a testfile
set f [open "test.bin" "w"]

puts $f "ttt"
puts $f "rrr"
puts $f "ttt"

close $f

#now test it.
set f [open "test.bin" "a+"]

seek $f 5
puts $f "qqq"

close $f

#BUG BUG BUG
#on my windows XP with 8.4.16, the file has the qqq appended to it, even
#though the documentation for 'a+' says: "Set the initial access position to the end of the file."
#(as oppossed to the docs for just 'a', which says: "Set the file pointer to the end of the file prior to each write."
#But it seems that a+ acts just like a!

#this is the current workaround
#make a testfile
set f [open "test2.bin" "w"]

puts $f "ttt"
puts $f "rrr"
puts $f "ttt"

close $f

#now test it.
set f [open "test2.bin" RDWR]

seek $f 5
puts -nonewline $f "qqq"

close $f

#after this, text rrr is correctly replaced by qqq, as expected