INtime SDK Help
creat

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

Parameters

filename
Pathname of file to be opened for writing.
pmode
Permission mode, one or more of the manifest constants described in chmod. Join multiple constants with the bitwise-OR operator (|). Applies to newly created files only.

Remarks

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.

Return Values

A descriptor for the created file.
Success.
-1 and sets errno to one of these values:
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.
Failure.

Requirements

Versions Defined in Include Link to
INtime 3.0 intime/rt/include/io.h sys/types.h
sys/stat.h
io.h
clib.lib

See Also

chmod, chsize, close, dup, dup2, sopen, umask