Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

2.14. Working With Files

Tcl has commands for accessing files. The open command opens a file. The second argument determines how the file should be opened. "r" opens a file for reading; "w" truncates a file and opens it for writing; "a" opens a file for appending (writing without truncation). The second argument defaults to "r".

open "/etc/passwd" "r"
open "/tmp/stuff.[pid]" "w"


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial