Open and read file line by line tcl tk

set fhandle [open http://www.com r]

while {[gets $fhandle lyne] > -1} {
set stuff "[lindex $lyne 0] - [lindex $lyne 6]"
puts $stuff
}

exit

--------- Description ---------------------

The program above opens a file in Tcl and reads it line by line
(the two parameter varient of "gets" putting the line into the
variable named as the second parameter.
posted @ 2011-04-27 23:02  greencolor  阅读(257)  评论(0编辑  收藏  举报