File Handling :
File names could be specified in Unix format.
In order to work with a file, first one has to open a channel to the file... this is also called handle
Once the channel is opened, TCL retruns a channelId which is used to work with the files
Typical steps to be followed while working with files:
Step 1: Check whether the file specified exists or not
Step 2: Open a channel pointing to the file... TCL returns an ID
Step 3: Use the ID to work with the file
Step 4: Close the channel after use
File Open :
"open " could be used to open a channel to a file. This command returns the file-handle (channelID ) which could be used to work with the files.
Syntax:
"open " opens a channel to the file specified by the fileName with the access permissions specified by the access mode. Default is "r".
A channel once opened, remains open until specifically closed.
File Close :
"close " is used to close a channel previously opened using the "open" command.
Syntax:
No comments:
Post a Comment