CREAT - create a new file or rewrite an old one.
(Compatible with UNIX System V C)
Usage:
#include <fildes.h>
fd = creat( name, mode );
Where:
- char *name;
- points to a string containing the name of the file to be
created.
- int mode;
- is ignored. It is merely included for compatibility with
UNIX C.
- int fd;
- is the file descriptor of the newly created file if the
creation was successful. Otherwise a -1 is returned and
the library variable "errno" is set to indicate
the error.
Description:
"creat" creates a file of the given name if the file
does not currently exist and opens the file for writing. If the
file does exist, it merely opens the file for writing.
"creat" is equivalent to
open( name, O_WRONLY, 0 )
Possible Errors:
- errno=ENOENT
- Pathname not found. This can also occur if
"name" was the NULL pointer.
- errno=EACCES
- The pathname referred to an existing read-only file or to
a directory instead of a file.
Notes:
"creat" is only supplied for compatibility with old
(UNIX) programs. New programs should simply use
"fopen".
Note that you must #include <fildes.h> or you will get
incorrect results.
See Also:
expl c lib open
expl c lib close
expl c lib errno
expl c include fildes
Copyright © 1996, Thinkage Ltd.