Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
6
Task/File-input-output/Tcl/file-input-output-1.tcl
Normal file
6
Task/File-input-output/Tcl/file-input-output-1.tcl
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
set in [open "input.txt" r]
|
||||
set out [open "output.txt" w]
|
||||
# Obviously, arbitrary transformations could be added to the data at this point
|
||||
puts -nonewline $out [read $in]
|
||||
close $in
|
||||
close $out
|
||||
5
Task/File-input-output/Tcl/file-input-output-2.tcl
Normal file
5
Task/File-input-output/Tcl/file-input-output-2.tcl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
set in [open "input.txt" r]
|
||||
set out [open "output.txt" w]
|
||||
fcopy $in $out
|
||||
close $in
|
||||
close $out
|
||||
1
Task/File-input-output/Tcl/file-input-output-3.tcl
Normal file
1
Task/File-input-output/Tcl/file-input-output-3.tcl
Normal file
|
|
@ -0,0 +1 @@
|
|||
file copy input.txt output.txt
|
||||
6
Task/File-input-output/Tcl/file-input-output-4.tcl
Normal file
6
Task/File-input-output/Tcl/file-input-output-4.tcl
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#open file for writing
|
||||
set myfile [open "README.TXT" w]
|
||||
#write something to the file
|
||||
puts $myfile "This is line 1, so hello world...."
|
||||
#close the file
|
||||
close $myfile
|
||||
9
Task/File-input-output/Tcl/file-input-output-5.tcl
Normal file
9
Task/File-input-output/Tcl/file-input-output-5.tcl
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#open file for reading
|
||||
set myfile [open "README.TXT" r]
|
||||
#read something from the file
|
||||
gets $myfile mydata
|
||||
#show what was read from the file
|
||||
#should print "This is line1, so hello world...."
|
||||
puts $mydata
|
||||
#close the file
|
||||
close $myfile
|
||||
Loading…
Add table
Add a link
Reference in a new issue