Skip to content

Instantly share code, notes, and snippets.

@etaf
Created September 15, 2014 11:07
Show Gist options
  • Save etaf/465ff8fb1feb7015a9c9 to your computer and use it in GitHub Desktop.
Save etaf/465ff8fb1feb7015a9c9 to your computer and use it in GitHub Desktop.
[ Tcl ] Read file to variable
#!/usr/bin/tclsh
set fp [open "tmp" r]
while {-1 != [gets $fp line]} {
puts "The current line is '$line'."
set vs [split $line " "]
set a [lindex $vs 0]
set b [lindex $vs 1]
puts "$a + $b = [expr $a+$b]"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment