-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Tcl/Tk 8.5 Programming Cookbook
The first item we will cover is how to open a file. When you open a file, Tcl creates what it refers to as a "channel" that can be read from and written to. Channels are also created for serial ports, external command pipelines, and when opening sockets.
The Tcl command to open a file is aptly named open. The open command accepts numerous flags to control access and permissions. These are covered in the following:
|
Access |
Interpretation |
|---|---|
|
r |
Opens the file for reading only. The file must already exist. Default access. |
|
r+ |
Opens the file for reading and writing. The file must already exist. |
|
w |
Opens the file for writing only. The file will be truncated if it already exists. If no named file exists, it will be created. |
|
w+ |
Opens the file for reading and writing. The file will be truncated if it already exists. If the named file does not exist, it will be created. |
|
a |
Opens the file for writing only. If the named file does not exist, it will be created. This will set... |
Change the font size
Change margin width
Change background colour