Creates a new file and opens it for writing in the specified permission mode or opens an existing file for writing and truncates it to length 0, destroying the previous contents.
#include <sys/types.h> #include <sys/stat.h> #include <io.h> int creat (const char *filename, mode_t pmode);
filename
pmode
creat applies the default file-permission mask (set with umask) to pmode
before setting the permissions. A new file receives the specified ownership and access rights after it is closed for the first time.
By default, files opened by this function are sharable by all threads. If O_EXCL is ORed with pmode
, the file is opened with share-with-none permission, like UNIX.
This function translates POSIX file ownership rights and access rights as described in chmod.
EACCES | Pathname specifies an existing read-only file or specifies a directory instead of a file. |
EMFILE | No more file descriptors available (too many open files). |
ENOENT | Pathname not found. |
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 | intime/rt/include/io.h | sys/types.h sys/stat.h io.h |
clib.lib |