1MKDTEMP(3)                 Linux Programmer's Manual                MKDTEMP(3)
2
3
4

NAME

6       mkdtemp - create a unique temporary directory
7

SYNOPSIS

9       #include <stdlib.h>
10
11       char *mkdtemp(char *template);
12
13   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15       mkdtemp():
16           _BSD_SOURCE
17           || /* Since glibc 2.10: */
18               (_POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700)
19

DESCRIPTION

21       The  mkdtemp()  function generates a uniquely named temporary directory
22       from template.  The last six characters of template must be XXXXXX  and
23       these  are replaced with a string that makes the directory name unique.
24       The directory is then created with permissions 0700.  Since it will  be
25       modified,  template  must  not  be  a  string  constant,  but should be
26       declared as a character array.
27

RETURN VALUE

29       The mkdtemp() function returns  a  pointer  to  the  modified  template
30       string  on  success,  and  NULL  on failure, in which case errno is set
31       appropriately.
32

ERRORS

34       EINVAL The last six characters of template were not XXXXXX.   Now  tem‐
35              plate is unchanged.
36
37       Also see mkdir(2) for other possible values for errno.
38

VERSIONS

40       Available since glibc 2.1.91.
41

CONFORMING TO

43       POSIX.1-2008.  This function is present on the BSDs.
44

SEE ALSO

46       mkdir(2), mkstemp(3), mktemp(3), tempnam(3), tmpfile(3), tmpnam(3)
47

COLOPHON

49       This  page  is  part of release 3.53 of the Linux man-pages project.  A
50       description of the project, and information about reporting  bugs,  can
51       be found at http://www.kernel.org/doc/man-pages/.
52
53
54
55GNU                               2010-09-26                        MKDTEMP(3)
Impressum