]>
Commit | Line | Data |
---|---|---|
fea681da MK |
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 | |
4 | .\" | |
5 | .\" Permission is granted to make and distribute verbatim copies of this | |
6 | .\" manual provided the copyright notice and this permission notice are | |
7 | .\" preserved on all copies. | |
8 | .\" | |
9 | .\" Permission is granted to copy and distribute modified versions of this | |
10 | .\" manual under the conditions for verbatim copying, provided that the | |
11 | .\" entire resulting derived work is distributed under the terms of a | |
12 | .\" permission notice identical to this one. | |
c13182ef | 13 | .\" |
fea681da MK |
14 | .\" Since the Linux kernel and libraries are constantly changing, this |
15 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
16 | .\" responsibility for errors or omissions, or for damages resulting from | |
17 | .\" the use of the information contained herein. The author(s) may not | |
18 | .\" have taken the same level of care in the production of this manual, | |
19 | .\" which is licensed free of charge, as they might when working | |
20 | .\" professionally. | |
c13182ef | 21 | .\" |
fea681da MK |
22 | .\" Formatted or processed versions of this manual, if unaccompanied by |
23 | .\" the source, must acknowledge the copyright and authors of this work. | |
151429b8 | 24 | .TH MKDTEMP 3 2010-09-15 "GNU" "Linux Programmer's Manual" |
fea681da MK |
25 | .SH NAME |
26 | mkdtemp \- create a unique temporary directory | |
27 | .SH SYNOPSIS | |
28 | .nf | |
29 | .B #include <stdlib.h> | |
30 | .sp | |
31 | .BI "char *mkdtemp(char *" template ); | |
32 | .fi | |
cc4615cc MK |
33 | .sp |
34 | .in -4n | |
35 | Feature Test Macro Requirements for glibc (see | |
36 | .BR feature_test_macros (7)): | |
37 | .in | |
38 | .sp | |
39 | .BR mkdtemp (): | |
151429b8 MK |
40 | .br |
41 | .ad l | |
42 | .RS 4 | |
43 | .PD 0 | |
cc4615cc | 44 | _BSD_SOURCE |
3ba63d80 MK |
45 | .br |
46 | || /* Since glibc 2.10: */ | |
47 | .RS 4 | |
48 | (_POSIX_C_SOURCE\ >=\ 200809L || _XOPEN_SOURCE\ >=\ 700) | |
49 | .ad | |
151429b8 MK |
50 | .PD |
51 | .RE | |
fea681da | 52 | .SH DESCRIPTION |
60a90ecd MK |
53 | The |
54 | .BR mkdtemp () | |
3f624b93 | 55 | function generates a uniquely named temporary |
c13182ef MK |
56 | directory from \fItemplate\fP. |
57 | The last six characters of \fItemplate\fP | |
fea681da | 58 | must be XXXXXX and these are replaced with a string that makes the |
c13182ef MK |
59 | directory name unique. |
60 | The directory is then created with | |
fea681da MK |
61 | permissions 0700. |
62 | Since it will be modified, | |
63 | .I template | |
64 | must not be a string constant, but should be declared as a character array. | |
65 | .SH "RETURN VALUE" | |
60a90ecd MK |
66 | The |
67 | .BR mkdtemp () | |
68 | function returns a pointer to the modified template | |
35e21ba7 | 69 | string on success, and NULL on failure, in which case |
0daa9e92 | 70 | .I errno |
fea681da MK |
71 | is set appropriately. |
72 | .SH ERRORS | |
73 | .TP | |
74 | .B EINVAL | |
75 | The last six characters of \fItemplate\fP were not XXXXXX. | |
76 | Now \fItemplate\fP is unchanged. | |
cf0a9ace | 77 | .PP |
60a90ecd MK |
78 | Also see |
79 | .BR mkdir (2) | |
80 | for other possible values for \fIerrno\fP. | |
2b2581ee MK |
81 | .SH VERSIONS |
82 | Available since glibc 2.1.91. | |
fea681da | 83 | .SH "CONFORMING TO" |
1cc22815 | 84 | POSIX.1-2008. |
2795ac0b | 85 | This function is present on the BSDs. |
68e1685c | 86 | .\" As at 2006, this function is being considered for a revision of POSIX.1 |
fea681da | 87 | .\" Also in NetBSD 1.4. |
fea681da MK |
88 | .SH "SEE ALSO" |
89 | .BR mkdir (2), | |
90 | .BR mkstemp (3), | |
91 | .BR mktemp (3), | |
92 | .BR tempnam (3), | |
93 | .BR tmpfile (3), | |
94 | .BR tmpnam (3) |