home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / tcl / tclX6.5c / tcllib / help / files / open < prev    next >
Encoding:
Text File  |  1992-12-19  |  2.8 KB  |  56 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.  If the
  40.                     file doesn't exist, create a new empty file.   Set
  41.                     the  initial  access  position   to the end of the
  42.                     file.
  43.  
  44.                Access defaults to r.  If a file  is  opened  for  both
  45.                reading  and writing, then seek must be invoked between
  46.                a read and a write, or  vice  versa  (this  restriction
  47.                does  not apply to command pipelines opened with open).
  48.                When  fileName  specifies  a  command  pipeline  and  a
  49.                write-only  access  is  used, then standard output from
  50.                the pipeline is directed to the current standard output
  51.                unless   overridden  by  the  command.   When  fileName
  52.                specifies a command pipeline and a read-only access  is
  53.                used,  then  standard  input from the pipeline is taken
  54.                from the current standard input  unless  overridden  by
  55.                the command.
  56.