sysopen
FILEHANDLE
,
FILENAME
,
MODE
sysopen
FILEHANDLE
,
FILENAME
,
MODE
,
PERMS
This function opens the file whose filename is given by
FILENAME
, and
associates it
with
FILEHANDLE
. If
FILEHANDLE
is an expression,
its value is used as the name of (or reference to) the filehandle.
This function calls
open
(2) with the
parameters
FILENAME
,
MODE
,
PERMS
.
The possible values and flag bits of the
MODE
parameter are
system-dependent; they are available via the Fcntl library module.
However, for historical reasons, some values are
universal: zero means read-only, one means write-only, and two means
read/write.
If the file named by
FILENAME
does not exist and
sysopen
creates it (typically because
MODE
includes the
O_CREAT
flag),
then the value of
PERMS
specifies the permissions of
the newly created file. If
PERMS
is omitted, the
default value is
0666
, which allows read and write for all.
This default is reasonable: see
umask
.
The FileHandle module described in
Chapter 7
provides a more
object-oriented approach to
sysopen
. See
also
open
earlier in this chapter.