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 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .TH MKDTEMP 3 2021-03-22 "Linux man-pages (unreleased)" "Linux Programmer's Manual"
8 mkdtemp \- create a unique temporary directory
11 .RI ( libc ", " \-lc )
14 .B #include <stdlib.h>
16 .BI "char *mkdtemp(char *" template );
20 Feature Test Macro Requirements for glibc (see
21 .BR feature_test_macros (7)):
26 /* Since glibc 2.19: */ _DEFAULT_SOURCE
27 || /* Glibc 2.19 and earlier: */ _BSD_SOURCE
28 || /* Since glibc 2.10: */ _POSIX_C_SOURCE >= 200809L
33 function generates a uniquely named temporary
34 directory from \fItemplate\fP.
35 The last six characters of \fItemplate\fP
36 must be XXXXXX and these are replaced with a string that makes the
37 directory name unique.
38 The directory is then created with
40 Since it will be modified,
42 must not be a string constant, but should be declared as a character array.
46 function returns a pointer to the modified template
47 string on success, and NULL on failure, in which case
49 is set to indicate the error.
53 The last six characters of \fItemplate\fP were not XXXXXX.
54 Now \fItemplate\fP is unchanged.
58 for other possible values for \fIerrno\fP.
60 Available since glibc 2.1.91.
62 For an explanation of the terms used in this section, see
70 Interface Attribute Value
73 T} Thread safety MT-Safe
80 This function is present on the BSDs.
81 .\" As at 2006, this function is being considered for a revision of POSIX.1
82 .\" Also in NetBSD 1.4.