NAME
create - create and open a satellite file for writing
SYNOPSIS
#include <stdio_p.h>
FD create (path, mode, size)
char *path;
int mode, size;
DESCRIPTION
create
creates and opens a satellite file for writing.
path
points to the path name of the file to create.
mode
is an octal number that specifies the permissions of the file and is
constructed from the OR of the following:
-
04 read
-
02 write
-
01 execute
size
is the number of contiguous 512 byte block to allocate the file.
If
path
does not exist,
create
creates it with the specified
mode
and
size
and opens it for writing returning a file descriptor. If
path
exists and is not write protected, it is truncated (its contents are
erased), its mode is unchanged, and its size is changed to
size.
create
will fail and no file will be created if one or more of the following
are true:
-
The path name points to a file on the host. [EACCES]
-
The path names specifies a directory that does not
exist. [ENOENT]
-
The created or existing file is write protected. [EACCES]
-
The directory is full. [EMXFILE]
-
The file system has run out of space. [ENOSPC]
RETURN VALUE
On successful completion, a value of 0 is returned. Otherwise, a
value of -1 is returned and
errno
is set to indicate the error.
SEE ALSO
open(2F)
,
fcreate(3F)