creat [ HP C/iX Library Reference Manual ] MPE/iX 5.0 Documentation
HP C/iX Library Reference Manual
creat
Creates a new file or rewrites an existing file.
Syntax
#include <fcntl.h>
creat (char *pathname, int mode)
Parameters
pathname A pointer to a string containing the pathname of a file to
be created or rewritten. The pathname must be terminated
by a null character.
mode The mode parameter is ignored. This parameter is provided
for compatibility with other systems.
Return Values
>=0 Success. A non-negative integer value is returned
representing the lowest unused file descriptor.
-1 An error occurred. No file has been created or modified
and errno is set to one of the following values:
EACCES A file access permission violation is
associated with one of the following:
* Search permission is denied within the
accessed group or account.
* The file does not exist and the group
in which the file is to be created
does not permit writing.
* The file exists and write permission
is denied.
EMPFILE More than the maximum number of file
descriptors are currently open.
ENOENT The pathname is NULL.
ESYSERR A call to a system intrinsic failed.
Description
The creat function opens for write-only access a file whose pathname is
specified in the string pointed to by pathname. The file offset is set
to the beginning of the file. Upon success, creat returns a file
descriptor used by other I/O functions to refer to the file.
The function call below:
creat (path, mode);
is equivalent to the following:
open (path, O_WRONLY | O_CREAT | O_TRUNC, mode);
[REV BEG]
NOTE If linking with the POSIX/iX library, refer to the description of
creat() located in the MPE/iX Developer's Kit Reference Manual.
[REV END]
See Also
open()
MPE/iX 5.0 Documentation