Wednesday, 8 February 2017

file Handling in tcl-tk

Check it @ Coding Ground



#!/usr/bin/tclsh



set infile [open "main.tcl" r]

set number 0





while {[gets $infile line] >=0} {

incr number

after 500

puts "$number $line"

}

close $infile





set outfile [open "report.out" w]

puts $outfile "Number of lines: $number"

close $outfile



set outfile [open "report.out" a]

puts $outfile "gone potatoes"

close $outfile

No comments:

Post a Comment