Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env tclsh
- set fname "my testing file.txt"
- set access(read) "r"
- set access(write) "w"
- set f_out [open $fname $access(write)]
- puts $f_out "Hello world!"
- for {set i 0} {$i < 10} {incr i} {
- puts $f_out "loto number: [expr {12000 + int(rand() * 1000)}]"
- }
- close $f_out
- set f_in [open $fname $access(read)]
- # emulates a 'puts [read $f_in]' command
- while {![eof $f_in]} {
- puts [gets $f_in]
- }
- close $f_in
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement