sysopen

sysopenFILEHANDLE,FILENAME,MODE,MASKsysopenFILEHANDLE,FILENAME,MODE
The sysopen 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. If
FILEHANDLE is a variable whose value is
undefined, a value will be created for you. The return value is true if
the call succeeds, and false otherwise.
This function is a direct interface to your operating system’s
open(2) syscall followed by an
fdopen(3) library call. As such, you’ll need to
pretend you’re a C programmer for a bit here. The possible values and
flag bits of the MODE parameter are available
through the Fcntl module. Because different systems support different
flags, don’t count on all of them being available on your system.
Consult your open(2) manpage or its local
equivalent for details. Nevertheless, the flags listed in Table 27-7 should be present on any system with a
reasonably standard C library.
Table 27-7. Flags for sysopen
| Flag | Meaning |
|---|---|
O_RDONLY | Read only. |
O_WRONLY | Write only. |
O_RDWR | Read and write. |
O_CREAT | Create the file if it doesn’t exist. |
O_EXCL | Fail if the file already exists. |
O_APPEND | Append to the file. |
O_TRUNC | Truncate the file. |
O_NONBLOCK | Nonblocking access. |
Many other options are ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access