NAME
mktemp - make a unique temporary filename
SYNOPSIS
#include <stdlib.h> char *mktemp(char *template); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): mktemp(): Since glibc 2.12: (_XOPEN_SOURCE >= 500) && ! (_POSIX_C_SOURCE >= 200112L) || /* Glibc since 2.19: */ _DEFAULT_SOURCE || /* Glibc <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE Before glibc 2.12: _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500
DESCRIPTION
Never use this function; see BUGS. The mktemp() function generates a unique temporary filename from template. The last six characters of template must be XXXXXX and these are replaced with a string that makes the filename unique. Since it will be modified, template must not be a string constant, but should be declared as a character array.
RETURN VALUE
The mktemp() function always returns template. If a unique name was created, the last six bytes of template will have been modified in such a way that the resulting name is unique (i.e., does not exist already) If a unique name could not be created, template is made an empty string, and errno is set to indicate the error.
ERRORS
EINVAL The last six characters of template were not XXXXXX.
ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). Interface Attribute Value mktemp() Thread safety MT-Safe
CONFORMING TO
4.3BSD, POSIX.1-2001. POSIX.1-2008 removes the specification of mktemp().
BUGS
Never use mktemp(). Some implementations follow 4.3BSD and replace XXXXXX by the current process ID and a single letter, so that at most 26 different names can be returned. Since on the one hand the names are easy to guess, and on the other hand there is a race between testing whether the name exists and opening the file, every use of mktemp() is a security risk. The race is avoided by mkstemp(3) and mkdtemp(3).
SEE ALSO
mktemp(1), mkdtemp(3), mkstemp(3), tempnam(3), tmpfile(3), tmpnam(3)
COLOPHON
This page is part of release 4.09 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/.
More Linux Commands
manpages/perlmacos.1.html
perlmacos(1) - Perl under Mac OS (Classic) - Linux man page
The port of Perl to to Mac OS was officially removed as of Perl 5.12, though the last official production release of MacPerl corresponded to Perl 5.6. While Per
manpages/glut.3.html
glut(3) - an introduction to the OpenGL Utility Toolkit.....
The OpenGL Utility Toolkit (GLUT) is a programming interface with ANSI C and FORTRAN bindings for writing window system independent OpenGL programs. The toolkit
manpages/acosl.3.html
acosl(3) - arc cosine function (Library - Linux man page)...
The acos() function calculates the arc cosine of x; that is the value whose cosine is x. RETURN VALUE On success, these functions return the arc cosine of x in
manpages/gitremote-helpers.1.html
gitremote-helpers(1) Helper programs to interact with remote
Remote helper programs are normally not used directly by end users, but they are invoked by Git when it needs to interact with remote repositories Git does not
manpages/lobase.1.html
lobase(1) - LibreOffice office suite - Linux manual page....
LibreOffice (LO for short) is a multi-platform office productivity suite. It was derived from OpenOffice.org 3.3 Beta on September 28, 2010. libreoffice is a sh
manpages/ldap_parse_result.3.html
ldap_parse_result(3) - Parsing results - Linux manual page
These routines are used to extract information from a result message. They will operate on the first result message in a chain of search results (skipping past
manpages/gnutls_x509_crl_check_issuer.3.html
gnutls_x509_crl_check_issuer(3) - API function (Man Page)...
This function will check if the given CRL was issued by the given issuer certificate. It will return true (1) if the given CRL was issued by the given issuer, a
manpages/ber_get_int.3.html
ber_get_int(3) - OpenLDAP LBER simplified Basic Encoding Rul
These routines provide a subroutine interface to a simplified implementation of the Basic Encoding Rules of ASN.1. The version of BER these routines support is
manpages/netconfig.5.html
netconfig(5) - network configuration data base (Man Page)...
The netconfig file defines a list of transport names, describing their semantics and protocol. In FreeBSD, this file is only used by the RPC library code. Entri
manpages/usleep.1.html
usleep(1) - sleep for the specified number of microseconds
usleep pauses for the number of usec microseconds. The default is 1 microsecond. If 0 microseconds are specified sched_yield(2) is called. BUGS The usleep progr
manpages/erb.1.html
erb(1) Ruby Templating (Commands - Linux manual page).......
erb is a command line front-end for ERB library, which is an implementation of eRuby. ERB provides an easy to use but powerful templating system for Ruby. Using
manpages/git-send-pack.1.html
git-send-pack(1) - Push objects over git protocol to another
Usually you would want to use git push, which is a higher-level wrapper of this command, instead. See git-push(1). Invokes git-receive-pack on a possibly remote
