fcreate - create and open a satellite file for writing


#include <stdio_p.h>

FILE *fcreate(path, mode, size)
char *path;
int mode, size;


fcreate 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 blocks to allocate the file.

If path does not exist, fcreate creates it with the specified mode and size, opens it for writing, and associates a stream with it. fcreate returns a pointer to be used to identify the stream in later operations. 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. If path specifies a host file, a non-existent directory or a write-protexted file fcreate fails and no file is created or opened.


On successful completion, a file pointer is returned. Otherwise, a value of NULL is returned.


fopen(3P) , create(2F).