mkdtemp

Creates a unique temporary directory.

Library:LibC
Classification:Single UNIX
Service:General C Services

Syntax

  #include <stdlib.h> 
   
  char *mkdtemp (
     char   *name );
  

Parameters

name

(IN) Points to a null-terminated string that contains a legal filename with six trailing X's.

Return Values

If successful, returns a pointer to the generated name; otherwise, returns a NULL pointer if a unique name could not be generated and sets errno.

Decimal

Constant

Description

9

EINVAL

The last six characters of name are not XXXXXX.

Remarks

The mkdtemp function replaces the six X's in the name parameter, making the directory name unique. Subsequent calls to this function continue to create unique names for a directory.

See Also