home *** CD-ROM | disk | FTP | other *** search
- '\"
- '\" Copyright (c) 1993 The Regents of the University of California.
- '\" All rights reserved.
- '\"
- '\" Permission is hereby granted, without written agreement and without
- '\" license or royalty fees, to use, copy, modify, and distribute this
- '\" documentation for any purpose, provided that the above copyright
- '\" notice and the following two paragraphs appear in all copies.
- '\"
- '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
- '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- '\"
- '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- '\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- '\"
- '\" $Header: /user6/ouster/tcl/man/RCS/open.n,v 1.1 93/05/10 17:10:32 ouster Exp $ SPRITE (Berkeley)
- '\" Modified for RISCOS by C.T.Stretch Mon,15 Aug 1994
- '\"
- .so man.macros
- .HS open tcl 7.0
- .BS
- '\" Note: do not modify the .SH NAME line immediately below!
- .SH NAME
- open \- Open a file
- .SH SYNOPSIS
- .VS
- \fBopen \fIfileName\fR ?\fIaccess\fR?
- .VE
- .BE
-
- .SH DESCRIPTION
- .PP
- This command opens a file and returns an identifier
- that may be used in future invocations
- of commands like \fBread\fR, \fBputs\fR, and \fBclose\fR.
- \fIFileName\fR gives the name of the file to open;
- .PP
- The \fIaccess\fR argument indicates the way in which the file
- is to be accessed.
- .VS
- It is a string in the form that would be
- passed to the \fBfopen\fR library procedure.
- It defaults to ``\fBrb\fR''.
- \fIAccess\fR may have any of the following values:
- .VE
- .TP 15
- \fBr\fR
- Open the file for reading only; the file must already exist.
- .TP 15
- \fBr+\fR
- Open the file for both reading and writing; the file must
- already exist.
- .TP 15
- \fBw\fR
- Open the file for writing only. Truncate it if it exists. If it doesn't
- exist, create a new file.
- .TP 15
- \fBw+\fR
- Open the file for reading and writing. Truncate it if it exists.
- If it doesn't exist, create a new file.
- .TP 15
- \fBa\fR
- Open the file for writing only. The file must already exist, and the file
- is positioned so that new data is appended to the file.
- .TP 15
- \fBa+\fR
- Open the file for reading and writing. If the file doesn't exist,
- create a new empty file.
- Set the initial access position to the end of the file.
- .PP
- Any of the above can be opened for binary access by adding a \fBb\fR to
- the access string.
- .PP
- If a file is opened for both reading and writing then \fBseek\fR
- must be invoked between a read and a write, or vice versa.
-
- .SH KEYWORDS
- access mode, append, create, file,
- non-blocking, open, permissions
-