1 .\" Copyright 2001 John Levon <moz@compsoc.man.ac.uk>
2 .\" Based on mkstemp(3), Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\" and GNU libc documentation
5 .\" %%%LICENSE_START(VERBATIM)
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein. The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
26 .TH MKDTEMP 3 2016-07-17 "GNU" "Linux Programmer's Manual"
28 mkdtemp \- create a unique temporary directory
31 .B #include <stdlib.h>
33 .BI "char *mkdtemp(char *" template );
37 Feature Test Macro Requirements for glibc (see
38 .BR feature_test_macros (7)):
46 /* Since glibc 2.19: */ _DEFAULT_SOURCE
48 || /* Glibc 2.19 and earlier: */ _BSD_SOURCE
50 || /* Since glibc 2.10: */
51 _POSIX_C_SOURCE\ >=\ 200809L
58 function generates a uniquely named temporary
59 directory from \fItemplate\fP.
60 The last six characters of \fItemplate\fP
61 must be XXXXXX and these are replaced with a string that makes the
62 directory name unique.
63 The directory is then created with
65 Since it will be modified,
67 must not be a string constant, but should be declared as a character array.
71 function returns a pointer to the modified template
72 string on success, and NULL on failure, in which case
78 The last six characters of \fItemplate\fP were not XXXXXX.
79 Now \fItemplate\fP is unchanged.
83 for other possible values for \fIerrno\fP.
85 Available since glibc 2.1.91.
87 For an explanation of the terms used in this section, see
93 Interface Attribute Value
96 T} Thread safety MT-Safe
100 This function is present on the BSDs.
101 .\" As at 2006, this function is being considered for a revision of POSIX.1
102 .\" Also in NetBSD 1.4.