CREAT(3C) COMMAND REFERENCE CREAT(3C)
NAME
creat - create a new file
SYNOPSIS
fd = creat(pathname, mode)
int fd;
char *pathname;
int mode;
DESCRIPTION
NOTE: This interface is made obsolete by open(2).
Creat creates a new file or prepares to rewrite an existing
file whose pathname is pathname. A file descriptor for the
file is returned in fd. If the file does not exist, it is
given mode mode, as modified by the process's mode mask (see
umask(2)). Also see chmod(2) for the construction of the
mode argument.
If the file does exist, its mode and owner remain unchanged
but it is truncated to zero length; the file is also opened
for writing.
DIAGNOSTICS
Creat will fail and the file will not be created or
truncated if one of the following occur:
[ENOASCII] The argument contains a byte with the high-
order bit set.
[ENOTDIR] A component of the path prefix is not a
directory.
[EACCES] A needed directory does not have search
permission.
[EACCES] The file does not exist and the directory in
which it is to be created is not writable.
[EACCES] The file exists, but it is unwritable.
[EISDIR] The file is a directory.
[EMFILE] NOFILE files are already open.
[EROFS] The named file resides on a read-only file
system.
[ENOSPC] The directory in which the entry for the new
file is being placed cannot be extended because
there is no space left on the file system
containing the directory.
Printed 5/12/88 1
CREAT(3C) COMMAND REFERENCE CREAT(3C)
[ENOENT] A component of the pathname which must exist
does not exist.
[EIO] An I/O error occurred while reading from or
writing to the file system.
[ENXIO] The file is a character special or block
special file, and the associated device does
not exist.
[ETXTBSY] The file is a pure procedure (shared text) file
that is being executed.
[EFAULT] Pathname points outside the process's allocated
address space.
[ELOOP] Too many symbolic links were encountered in
translating the pathname.
[EOPNOTSUPP] The file is a socket (not currently
implemented).
RETURN VALUE
[-1] This value is returned if an error occurs.
If there is no error, the call returns a nonnegative
descriptor which only permits writing.
SEE ALSO
open(2), chmod(2), close(2), umask(2), unlink(2), and
write(2).
Printed 5/12/88 2
%%index%%
na:288,77;
sy:365,681;
de:1046,862;
di:1908,1147;3415,778;
rv:4193,292;
se:4485,246;
%%index%%000000000118