04.06.2013 Views

iRMX C Library Reference - tenAsys

iRMX C Library Reference - tenAsys

iRMX C Library Reference - tenAsys

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

stdio creat<br />

creat<br />

Syntax<br />

Creates a new file and opens it for writing in the specified permission mode or opens<br />

an existing file for writing and truncates it to length 0, destroying the previous<br />

contents.<br />

#include <br />

#include <br />

#include <br />

int creat (const char *filename, mode_t pmode);<br />

Parameters<br />

filename<br />

Pathname of file to be opened for writing.<br />

pmode Permission mode, one or more of the manifest constants described in chmod( ). Join<br />

multiple constants with the bitwise-OR operator (|). Applies to newly created files<br />

only.<br />

Additional Information<br />

Returns<br />

The creat( ) function applies the default file-permission mask (set with the umask( )<br />

function) to pmode before setting the permissions. A new file receives the specified<br />

ownership and access rights after it is closed for the first time.<br />

By default, files opened by this function are sharable by all tasks. If O_EXCL is<br />

ORed with pmode, the file is opened with share-with-none permission, like UNIX.<br />

This function translates POSIX file ownership rights and access rights as described in<br />

chmod( ).<br />

See also: chmod( ), chsize( ), close( ), dup( ), dup2( ), open( ), sopen( ), umask( )<br />

A descriptor for the created file.<br />

-1 and sets errno to one of these values if unsuccessful:<br />

EACCES Pathname specifies an existing read-only file or specifies a directory<br />

instead of a file.<br />

EMFILE No more file descriptors available (too many open files).<br />

C <strong>Library</strong> <strong>Reference</strong> Chapter 3 51

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!