Created
September 15, 2014 11:07
-
-
Save etaf/465ff8fb1feb7015a9c9 to your computer and use it in GitHub Desktop.
[ Tcl ] Read file to variable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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