| www.delorie.com/djgpp/doc/libc-2.01/libc_489.html | search |
#include <fcntl.h> #include <sys/stat.h> /* for mode definitions */ int open(const char *file, int mode /*, int permissions */);
This function opens the named file in the given mode, which is any combination of the following:
O_RDONLY
O_WRONLY
O_RDWR
O_CREAT
O_TRUNC
O_EXCL
O_CREAT is also specified, the
open call will fail.
O_APPEND
O_TEXT
_fmode variable section _fmode.
O_BINARY
open will disable
the generation of SIGINT when you press Ctrl-C
(Ctrl-Break will still cause SIGINT), because many programs
that use binary reads from the console will also want to get the
`^C' characters. You can use the __djgpp_set_ctrl_c library
function (see section __djgpp_set_ctrl_c) if you want Ctrl-C to
generate interrupts while console is read in binary mode.
If the file is created by this call, it will be given the read/write permissions specified by permissions, which may be any combination of these values:
S_IRUSR
S_IWUSR
Other S_I* values may be included, but they will be ignored.
If successful, the file descriptor is returned. On error, a negative
number is returned and errno is set to indicate the error.
int q = open("/tmp/foo.dat", O_RDONLY|O_BINARY);
Go to the first, previous, next, last section, table of contents.
| prev next webmaster | delorie software privacy |
| Copyright © 1997 | Updated Apr 1997 |