Anonymous user
Read a file line by line: Difference between revisions
→Tcl: Added implementation
m (whitespace) |
(→Tcl: Added implementation) |
||
Line 1:
{{task|File System Operations}}
The task is to demonstrate how to read a file line by line (as opposed to [[Read entire file|reading the entire file]]).
=={{header|Tcl}}==
<lang tcl>set f [open "foobar.txt"]
while {[gets $f line] >= 0} {
# This loops over every line
puts ">>$line<<"
}
close $f</lang>
=={{header|UNIX Shell}}==
|