table of contents
other versions
- wheezy 3.44-1
- jessie 3.74-1
- jessie-backports 4.10-2~bpo8+1
- testing 4.10-2
- unstable 4.10-2
MKSTEMP(3) | Linux Programmer's Manual | MKSTEMP(3) |
NAME¶
mkstemp, mkostemp, mkstemps, mkostemps - create a unique temporary fileSYNOPSIS¶
#include <stdlib.h>int mkstemp(char *template);int mkostemp(char *template, int flags);int mkstemps(char *template, int suffixlen);int mkostemps(char *template, int suffixlen, int flags);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
_BSD_SOURCE || _SVID_SOURCE ||
_XOPEN_SOURCE >= 500 ||
_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
|| /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200112L
mkostemp(): _GNU_SOURCE
DESCRIPTION¶
The mkstemp() function generates a unique temporary filename from template, creates and opens the file, and returns an open file descriptor for the file.RETURN VALUE¶
On success, these functions return the file descriptor of the temporary file. On error, -1 is returned, and errno is set appropriately.ERRORS¶
- EEXIST
- Could not create a unique temporary filename. Now the contents of template are undefined.
- EINVAL
- For mkstemp() and mkostemp(): The last six
characters of template were not XXXXXX; now template is
unchanged.
VERSIONS¶
mkostemp() is available since glibc 2.7. mkstemps() and mkostemps() are available since glibc 2.11.CONFORMING TO¶
mkstemp(): 4.3BSD, POSIX.1-2001.NOTES¶
The old behavior of creating a file with mode 0666 may be a security risk, especially since other UNIX flavors use 0600, and somebody might overlook this detail when porting programs.SEE ALSO¶
mkdtemp(3), mktemp(3), tempnam(3), tmpfile(3), tmpnam(3)COLOPHON¶
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/.2012-04-21 | GNU |