Name

readall — Reads an entire file and returns its contents.

Synopsis

readall filename

Description

The readall command reads an entire file and returns its contents. filename.

Example

set data [readall foo.txt]
set lines [split $data "\n"]
set i 1
foreach line $lines {
    puts "$i $line"
    incr $i
}
	  

Produces:

1 .....
2 ........
3 ........
etc...