Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2011-05-18
05:15 • Closed ticket [3303431fff]: read command should be able to close the channel... artifact: 97f6115de9 user: ferrieux
2011-05-17
16:42 • New ticket [3303431fff]. artifact: c38831282b user: proteco

read command should be able to close the channel

Closed / Invalid3303431fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 16 years ago
Descriptionplain2011-05-17 16:42:25
New option could be introduced to read command, for example: -close true, that would allow the command to automatically close the channel after reading its contents. It would be useful in many aspects, for example the channel reference could be not stored into the variable.
Alternative way is to add ability to read contents directly from the file like: read "data.txt" -file
ferrieuxplain2011-05-18 05:15:01
allow_comments - 1

That's arbitrarily blending two primitives, and is trivially done at script level:

    proc readandclose ch {set x [read $ch];close $ch;return $x}
Log in (anonymous is fine) to add a comment.