给你个程序,语法通过了,可是功能不对。帮忙调试下
set f1 [open "c:/data.txt"]
set f2 [open "c:/result.txt" w]
set i 0
while {![eof $f1]} {
gets $f1 a($i)
incr i
}
incr i -1
for {set b 0} {$b<=[expr [llength a(0)]-1]} {incr b} {
for {set c 0} {$c<=$i} {incr c} {
lappend h [lindex $a($c) $b]
}
puts $f2 $h
set h ""
}
close $f1
close $f2