OSDN Git Service

f59757cb0807fa05d4ae136b4392e163839a7795
[linuxjm/LDP_man-pages.git] / original / man3 / mkdtemp.3
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 .\" %%%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.
9 .\"
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.
14 .\"
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
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" %%%LICENSE_END
26 .TH MKDTEMP 3  2010-09-26 "GNU" "Linux Programmer's Manual"
27 .SH NAME
28 mkdtemp \- create a unique temporary directory
29 .SH SYNOPSIS
30 .nf
31 .B #include <stdlib.h>
32 .sp
33 .BI "char *mkdtemp(char *" template );
34 .fi
35 .sp
36 .in -4n
37 Feature Test Macro Requirements for glibc (see
38 .BR feature_test_macros (7)):
39 .in
40 .sp
41 .BR mkdtemp ():
42 .br
43 .ad l
44 .RS 4
45 .PD 0
46 _BSD_SOURCE
47 .br
48 || /* Since glibc 2.10: */
49 .RS 4
50 (_POSIX_C_SOURCE\ >=\ 200809L || _XOPEN_SOURCE\ >=\ 700)
51 .ad
52 .PD
53 .RE
54 .RE
55 .SH DESCRIPTION
56 The
57 .BR mkdtemp ()
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
64 permissions 0700.
65 Since it will be modified,
66 .I template
67 must not be a string constant, but should be declared as a character array.
68 .SH RETURN VALUE
69 The
70 .BR mkdtemp ()
71 function returns a pointer to the modified template
72 string on success, and NULL on failure, in which case
73 .I errno
74 is set appropriately.
75 .SH ERRORS
76 .TP
77 .B EINVAL
78 The last six characters of \fItemplate\fP were not XXXXXX.
79 Now \fItemplate\fP is unchanged.
80 .PP
81 Also see
82 .BR mkdir (2)
83 for other possible values for \fIerrno\fP.
84 .SH VERSIONS
85 Available since glibc 2.1.91.
86 .SH CONFORMING TO
87 POSIX.1-2008.
88 This function is present on the BSDs.
89 .\" As at 2006, this function is being considered for a revision of POSIX.1
90 .\" Also in NetBSD 1.4.
91 .SH SEE ALSO
92 .BR mkdir (2),
93 .BR mkstemp (3),
94 .BR mktemp (3),
95 .BR tempnam (3),
96 .BR tmpfile (3),
97 .BR tmpnam (3)
98 .SH COLOPHON
99 This page is part of release 3.64 of the Linux
100 .I man-pages
101 project.
102 A description of the project,
103 and information about reporting bugs,
104 can be found at
105 \%http://www.kernel.org/doc/man\-pages/.