create - create and open a satellite file for writing


#include <stdio_p.h>

FD create (path, mode, size)
char *path;
int mode, size;


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:

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:


On successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.


open(2F) , fcreate(3F)