Go to the previous, next section.
int open(const char *path, int flags);
int open(const char *path, int flags, mode_t
mode);
int creat(const char *path, mode_t mode);
path: [in] the path of the new file to create.
mode: [in] the new permission mask of the file. It is masked by
the umask value: (mode & ~umask).
flags: [in] flags (see description).
open opens an file. The flags parameter must be one of the following:
O_RDONLY
O_WRONLY
O_RDWR
The following values may be or'ed together and with one of the preceding values:
O_CREAT
O_EXCL
O_CREAT, if the file exists, the call fails. The test
for existence and the creation if the file does not exists is atomic
operation according to POSIX.1.
O_NOCTTY
O_TRUNC
O_APPEND
O_NONBLOCK or O_NDELAY
O_SYNC
create creates a new file. The new file is open for writing
only. If a file with the same path already existed, then it is trucated.
On success, a file descriptor for the file is returned. This file descriptor is the lowest numbered unused descriptor. On error, those calls return -1, and errno is set to one of the following values.
EISDIR: the last component of the path is a directory.
ETXTBSY: tried to create an already used executable.
EFAULT, EACCESS, ENAMETOOLONG, ENOENT,
ENOTDIR, EMFILE, ENFILE, ENOMEM,
EROFS, ELOOP, EEXIST or ENOSPC.
Go to the previous, next section.