open FileName ACCESS |
set infile [open "input.data" r] set outfile [open "output.data" w] |
The variables infile and outfile will be used in further file access commands (such as reading from or writing to a file)
gets $FileID nextLine |
(It also discards the terminating newline character)
gets stdin nextLine |
Type in something at the "empty prompt" !
Try typing in "Control-D" !!
set infile [open "input.data" r] gets $infile nextLine |
Create a data file named "input.data" !
puts $FileID $nextLine |
(It also add a terminating newline character)
set nextLine Hello puts stdout $nextLine |
set outfile [open "output.data" w] set nextLine Hello puts $outfile $nextLine |
Create a data file named "input.data" !
flush $fileID // flush any output that has been buffered close $fileID // close the file |