Declaration:
int creatnew(char path[], int amode);
Description
Creates a new file.
creatnew is identical to creat with the only exception: if the file exists, then creatnew will return error and leave the file untouched. The amode
FA_HIDDEN Hidden file
FA_RDONLY Read-only attribute
FA_SYSTEM System file
Returned value
Upon successful completion, creatnew returns the handle of new file (a non-negative integer); otherwise, it returns -1. In the event of error, the errno global variable is set to one of the following values:
EACCES Permission denied
EEXIST File already exists
EMFILE Too many open files
ENOENT Path or file name not found
|