MKTEMP

Section: C Library Functions (3)
Updated: May 14, 1986
Index Return to Main Contents
 

NAME

mktemp - make a unique file name  

SYNOPSIS

char *mktemp(template)
char *template;

mkstemp(template)
char *template;
 

DESCRIPTION

Mktemp creates a unique file name, typically in a temporary filesystem, by replacing template with a unique file name, and returns the address of the template. The template should contain a file name with six trailing X's, which are replaced with the current process id and a unique letter. Mkstemp makes the same replacement to the template but returns a file descriptor for the template file open for reading and writing. Mkstemp avoids the race between testing whether the file exists and opening it for use.  

SEE ALSO

getpid(2), open(2)  

DIAGNOSTICS

Mkstemp returns an open file descriptor upon success. It returns -1 if no suitable file could be created.


 

Index

NAME
SYNOPSIS
DESCRIPTION
SEE ALSO
DIAGNOSTICS

This document was created by man2html, using the manual pages.
Time: 17:22:09 GMT, March 25, 2025