is there a way to save last 5 topic ? well i mean i know how to save topics on a file. But how to ask bot to replace a special line like when 5 topic are saved on the file bot will replace the topic#1 by the topic#6 .... replace topic#2 by topic#7 ..etc understand ? :-/
not my first language sorry ) if someone know a TCL that use something like that let me know thx!
It would be more simple, to read in each line from the file into a list, remove the first item in the list and append a new item to the end. The list can then be saved to file, rather than make some hardworking script to replace items.
proc file_item_shift {filename newitem} {
set fp [open $filename r]
set r [split [read $fp] "n"]
close $fp
set r [lreplace $r 0 0]
lappend r $newitem
set fp [open $filename w]
foreach _A $r {
puts $fp "$_A"
}
close $fp
}
Not tested, but should work. Should realy make a backup copy of the file as well, to save some heartache later on.