| www.delorie.com/djgpp/doc/libc-2.01/libc_103.html | search |
#include <fcntl.h> #include <sys/stat.h> /* for mode definitions */ int creat(const char *filename, mode_t mode);
This function creates the given file and opens it for writing. If the
file exists, it is truncated to zero size, unless it is read-only, in
which case the function fails. If the file does not exist, it will be
created read-only if mode does not have S_IWUSR set.
A file descriptor >= 0, or a negative number on error.
int fd = creat("data", S_IRUSR|S_IWUSR);
write(fd, buf, 1024);
close(fd);
Go to the first, previous, next, last section, table of contents.
| prev next webmaster | delorie software privacy |
| Copyright © 1997 | Updated Apr 1997 |