OSDN Git Service

98a9e3c9903c0b2f004d0d827218f17202c330b2
[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 .\" 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.
13 .\"
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.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .TH MKDTEMP 3  2008-08-21 "GNU" "Linux Programmer's Manual"
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
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 ():
40 _BSD_SOURCE
41 .SH DESCRIPTION
42 The
43 .BR mkdtemp ()
44 function generates a uniquely named temporary
45 directory from \fItemplate\fP.
46 The last six characters of \fItemplate\fP
47 must be XXXXXX and these are replaced with a string that makes the
48 directory name unique.
49 The directory is then created with
50 permissions 0700.
51 Since it will be modified,
52 .I template
53 must not be a string constant, but should be declared as a character array.
54 .SH "RETURN VALUE"
55 The
56 .BR mkdtemp ()
57 function returns a pointer to the modified template
58 string on success, and NULL on failure, in which case
59 .I errno
60 is set appropriately.
61 .SH ERRORS
62 .TP
63 .B EINVAL
64 The last six characters of \fItemplate\fP were not XXXXXX.
65 Now \fItemplate\fP is unchanged.
66 .PP
67 Also see
68 .BR mkdir (2)
69 for other possible values for \fIerrno\fP.
70 .SH VERSIONS
71 Available since glibc 2.1.91.
72 .SH "CONFORMING TO"
73 POSIX.1-2008.
74 This function is present on the BSDs.
75 .\" As at 2006, this function is being considered for a revision of POSIX.1
76 .\" Also in NetBSD 1.4.
77 .SH "SEE ALSO"
78 .BR mkdir (2),
79 .BR mkstemp (3),
80 .BR mktemp (3),
81 .BR tempnam (3),
82 .BR tmpfile (3),
83 .BR tmpnam (3)