mktemp
Purpose
Constructs a unique file name.
Library
Standard C Library (libc.a)
Syntax
char *mktemp (template)
char *template;
Description
The mktemp subroutine replaces the contents of the string
pointed to by the template parameter with a unique file
name.
The string in the template parameter must be a file name
with six trailing "X"s. The mktemp subroutine replaces
the "X"s with a randomly generated character sequence.
Upon successful completion, the mktemp subroutine returns
the address of the string pointed to by the template
parameter.
If the string pointed to by the template parameter con-
tains no "X"s, or if mktemp is unable to construct a
unique file name from the randomly generated character
sequence, then the first character of the template string
is replaced with a null character.
Related Information
In this book: "getpid, getpgrp, getppid," "tmpfile," and
"tmpnam, tempnam."