mkstemp

Creates a new file with a unique name in the current directory.

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

Syntax

  #include <stdlib.h> 
   
  int mkstemp (
     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 file descriptor; otherwise, returns -1 if a unique name could not be generated.

Remarks

The mkstemp function replaces the six X's in the name parameter with an alpha-numeric sequence. The resulting filename is guaranteed to be unique in the current directory. Subsequent calls to this function continue to create unique names for the current directory.

See Also

mktemp