

creat()                COHERENT System Call               creat()




Create/truncate a file

iinntt ccrreeaatt(_f_i_l_e, _m_o_d_e) cchhaarr *_f_i_l_e; iinntt _m_o_d_e;

creat  creates a  new  file or  truncates an  existing file.   It
returns  a file  descriptor that  identifies file  for subsequent
system calls.   If file already exists,  its contents are erased.
In this  case, creat ignores the specified _m_o_d_e;  the mode of the
file remains unchanged.   If file did not exist previously, creat
uses the  mode argument  to determine the  mode of the  new file.
For a full definition of file modes, see chmod or the header file
stat.h.  creat masks the mode argument with the current umask, so
it  is common  practice  to create  files with  the maximal  mode
desirable.

***** Example *****

For an  example of  how to  use this routine,  see the  entry for
open.

***** See Also *****

chmod(), COHERENT system calls(), fopen(), open(), stat.h, STDIO

***** Diagnostics *****

If the  call is successful, creat returns  a file descriptor.  It
returns -1 if it could  not create the file, typically because of
insufficient system resources or protection violations.



























COHERENT Lexicon                                           Page 1


