home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / tclX-6.4 / help / files / open < prev    next >
Encoding:
Text File  |  1992-12-17  |  2.7 KB  |  55 lines

  1.           open fileName ?access?
  2.                Opens a file and returns an identifier that may be used
  3.                in future invocations of commands like read, write, and
  4.                close.  FileName gives the name of the file to open; if
  5.                it  starts  with  a  tilde  then  tilde substitution is
  6.                performed as  described  for  Tcl_TildeSubst.   If  the
  7.                first character of fileName is ``|'' then the remaining
  8.                characters  of  fileName  are  treated  as  a   command
  9.                pipeline  to invoke, in the same style as for exec.  In
  10.                this case, the identifier returned by open may be  used
  11.                to  write  to the command's input pipe or read from its
  12.                output pipe.  The access argument indicates the way  in
  13.                which the file (or command pipeline) is to be accessed.
  14.                It may have any of the following values:
  15.  
  16.                r
  17.                     Open  the  file  for  reading  only; the file must
  18.                     already exist.
  19.  
  20.                r+
  21.                     Open  the  file  for both reading and writing; the
  22.                     file must already exist.
  23.  
  24.                w
  25.                     Open the file for writing only.  Truncate it if it
  26.                     exists.  If it doesn't exist, create a new file.
  27.  
  28.                w+
  29.                     Open  the  file for reading and writing.  Truncate
  30.                     it if it exists.  If it doesn't  exist,  create  a
  31.                     new file.
  32.  
  33.                a
  34.                     Open  the  file  for  writing only.  The file must
  35.                     already exist, and the file is positioned so  that
  36.                     new data is appended to the file.
  37.  
  38.                a+
  39.                     Open  the  file for reading and writing.  The file
  40.                     must  already  exist,  and  the   initial   access
  41.                     position is set to the end of the file.
  42.  
  43.                Access defaults to r.  If a file  is  opened  for  both
  44.                reading  and writing, then seek must be invoked between
  45.                a read and a write, or  vice  versa  (this  restriction
  46.                does  not apply to command pipelines opened with open).
  47.                When  fileName  specifies  a  command  pipeline  and  a
  48.                write-only  access  is  used, then standard output from
  49.                the pipeline is directed to the current standard output
  50.                unless   overridden  by  the  command.   When  fileName
  51.                specifies a command pipeline and a read-only access  is
  52.                used,  then  standard  input from the pipeline is taken
  53.                from the current standard input  unless  overridden  by
  54.                the command.
  55.