I have some problems to read correctly 2 files :
filetest1.txt contains :
chocolate
coconut
banana
filetest2.txt contains :
strawberry
orange
procedure :
proc callme {file1 file2} {
set file1 [open $file1 r]
set file2 [open $file2 r]
while {[gets $file1 line1] != -1} {
while {[gets $file2 line2] != -1} {
puts "inside : $line1"
}
puts "outside : $line1"
}
close $file1
close $file2
}
callme filetest1.txt filetest2.txt
the ouput shows :
inside : chocolate
inside : chocolate
outside : chocolate
outside : coconut
outside : banana
So my question is why there is only :
inside : chocolate
inside : chocolate
I've expected to have :
inside : chocolate
inside : chocolate
outside : chocolate
inside : coconut
inside : coconut
outside : coconut
inside : banana
inside : banana
outside : banana
Thanks.