CREAT (II)                   3/15/72                   CREAT (II)

NAME            creat  --  create a new file

SYNOPSIS        sys     creat; name; mode       / creat = 8.

                (file descriptor in r0)

DESCRIPTION     creat creates a new file or prepares to rewrite

                an existing file called name; name is the address

                of a null-terminated string.  If the file did not

                exist, it is given mode mode; if it did exist,

                its mode and owner remain unchanged but it is

                truncated to 0 length.

                The file is also opened for writing, and its file

                descriptor is returned in r0.

                The mode given is arbitrary; it need not allow

                writing.  This feature is used by programs which

                deal with temporary files of fixed names.  The

                creation is done with a mode that forbids writ-

                ing.  Then if a second instance of the program

                attempts a creat, an error is returned and the

                program knows that the name is unusable for the


SEE ALSO        write(II), close(II)

DIAGNOSTICS     The error bit (c-bit) may be set if: a needed di-

                rectory is not readable; the file does not exist

                and the directory in which it is to be created is

                not writable; the file does exist and is un-

                writable; the file is a directory; there are al-

                ready 10 files open.

BUGS            --