Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

open(2)

chmod(2)

close(2)

umask(2)

unlink(2)

write(2)



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).

     The creat utility creates a new file or prepares to rewrite
     an existing file whose path name 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
     If one of the following occur, creat will fail and the file
     will not be created or truncated:

     [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 4/4/89                                                  1





CREAT(3C)               COMMAND REFERENCE               CREAT(3C)



     [ENOENT]     A component of the path name 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 path name.

     [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 4/4/89                                                  2



%%index%%
na:288,77;
sy:365,681;
de:1046,875;
di:1921,1148;3429,780;
rv:4209,292;
se:4501,246;
%%index%%000000000118

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026