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(): _BSD_SOURCE
16

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

VERSIONS

37       Available since glibc 2.1.91.
38

CONFORMING TO

40       POSIX.1-2008.  This function is present on the BSDs.
41

SEE ALSO

43       mkdir(2), mkstemp(3), mktemp(3), tempnam(3), tmpfile(3), tmpnam(3)
44

COLOPHON

46       This  page  is  part of release 3.22 of the Linux man-pages project.  A
47       description of the project, and information about reporting  bugs,  can
48       be found at http://www.kernel.org/doc/man-pages/.
49
50
51
52GNU                               2008-08-21                        MKDTEMP(3)
Impressum