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 2021-03-22 "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)):
43 /* Since glibc 2.19: */ _DEFAULT_SOURCE
44 || /* Glibc 2.19 and earlier: */ _BSD_SOURCE
45 || /* Since glibc 2.10: */ _POSIX_C_SOURCE >= 200809L
50 function generates a uniquely named temporary
51 directory from \fItemplate\fP.
52 The last six characters of \fItemplate\fP
53 must be XXXXXX and these are replaced with a string that makes the
54 directory name unique.
55 The directory is then created with
57 Since it will be modified,
59 must not be a string constant, but should be declared as a character array.
63 function returns a pointer to the modified template
64 string on success, and NULL on failure, in which case
66 is set to indicate the error.
70 The last six characters of \fItemplate\fP were not XXXXXX.
71 Now \fItemplate\fP is unchanged.
75 for other possible values for \fIerrno\fP.
77 Available since glibc 2.1.91.
79 For an explanation of the terms used in this section, see
87 Interface Attribute Value
90 T} Thread safety MT-Safe
97 This function is present on the BSDs.
98 .\" As at 2006, this function is being considered for a revision of POSIX.1
99 .\" Also in NetBSD 1.4.