open_trunc man page

open_trunc — open a file for writing


#include <open.h>

int open_trunc(const char *filename);


open_trunc opens the file filename for write-only use and returns the file handle.  If the file exists, it will be truncated to zero bytes length.  If it does not exist, it will be created with mode 0644.  If there was an error opening or creating the file, open_trunc returns -1 and sets errno accordingly.

See Also