CINXE.COM

mkdtemp

<html> <head> <title>mkdtemp</title> <META NAME="KEYWORDS" CONTENT="mkdtemp"> </head> <body BGCOLOR="#ffffff" LINK="#0000ff" VLINK="#0000ff" ALINK="#0000ff" TEXT="#000000"> <center> <h1><b>mkdtemp</b></h1></center> <PRE> <STRONG><A HREF="/man3/MKDTEMP">MKDTEMP(3)</A></STRONG> Linux Programmer's Manual <STRONG><A HREF="/man3/MKDTEMP">MKDTEMP(3)</A></STRONG> NAME mkdtemp - create a unique temporary directory SYNOPSIS #include &lt;stdlib.h&gt; char *mkdtemp(char *template); Feature Test Macro Requirements for glibc (see <STRONG><A HREF="/man7/feature_test_macros">feature_test_macros(7)</A></STRONG>): mkdtemp(): /* Since glibc 2.19: */ _DEFAULT_SOURCE || /* Glibc 2.19 and earlier: */ _BSD_SOURCE || /* Since glibc 2.10: */ _POSIX_C_SOURCE &gt;= 200809L DESCRIPTION The mkdtemp() function generates a uniquely named temporary directory from template. The last six characters of template must be XXXXXX and these are replaced with a string that makes the directory name unique. The directory is then created with permissions 0700. Since it will be modified, template must not be a string constant, but should be de- clared as a character array. RETURN VALUE The mkdtemp() function returns a pointer to the modified template string on success, and NULL on failure, in which case errno is set ap- propriately. ERRORS EINVAL The last six characters of template were not XXXXXX. Now tem- plate is unchanged. Also see <STRONG><A HREF="/man2/mkdir">mkdir(2)</A></STRONG> for other possible values for errno. VERSIONS Available since glibc 2.1.91. ATTRIBUTES For an explanation of the terms used in this section, see at- <STRONG><A HREF="/man7/tributes">tributes(7)</A></STRONG>. +----------+---------------+---------+ |Interface | Attribute | Value | +----------+---------------+---------+ |mkdtemp() | Thread safety | MT-Safe | +----------+---------------+---------+ CONFORMING TO POSIX.1-2008. This function is present on the BSDs. SEE ALSO <STRONG><A HREF="/man1/mktemp">mktemp(1)</A></STRONG>, <STRONG><A HREF="/man2/mkdir">mkdir(2)</A></STRONG>, <STRONG><A HREF="/man3/mkstemp">mkstemp(3)</A></STRONG>, <STRONG><A HREF="/man3/mktemp">mktemp(3)</A></STRONG>, <STRONG><A HREF="/man3/tempnam">tempnam(3)</A></STRONG>, <STRONG><A HREF="/man3/tmpfile">tmpfile(3)</A></STRONG>, <STRONG><A HREF="/man3/tmpnam">tmpnam(3)</A></STRONG> COLOPHON This page is part of release 5.05 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. GNU 2016-07-17 <STRONG><A HREF="/man3/MKDTEMP">MKDTEMP(3)</A></STRONG></PRE> <center> <h6>Man Pages Copyright Respective Owners. Site Copyright (C) 1994 - 2025 <a href="http://www.he.net">Hurricane Electric</a>. All Rights Reserved.</h6></center> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10