Declaration:
int creattemp(char path[], int attrib);
Description
Creates a unique file in the directory associated with the path name. A file created with creattemp is always created in the translation mode specified by the _fmode global variable (O_TEXT or O_BINARY).
path is the path name ending with backslash (\). The unique file name is selected in the directory given by path. The newly created file name is stored in the path string supplied. path should be long enough to hold the resulting file name. The file is not automatically deleted, when the program terminates.
creattemp accepts attrib, the DOS attribute word. Upon successful file creation, the file pointer is set to the beginning of the file. The file is opened for both reading and writing.
The attrib argument to creattemp can be either zero or an OR-combination of any of the following constants (defined in system.h):
FA_HIDDEN Hidden file
FA_RDONLY Read-only attribute
FA_SYSTEM System file
Returned value
Upon successful completion, the new file handle (a non-negative integer) is returned; otherwise, -1 is returned. In the event of error, the errno global variable is set to one of the following values:
EACCES Permission denied
EMFILE Too many open files
ENOENT Path or file name not found
|