Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ mkstemp(3) — Duplix 5.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

getpid(2)

open(2)

MKTEMP(3)  —  Unix Programmer’s Manual

NAME

mktemp − make a unique filename

SYNOPSIS

char ∗mktemp(template)
char ∗template;
mkstemp(template)
char ∗template;

DESCRIPTION

Mktemp creates a unique filename, typically in a temporary filesystem, by replacing template with a unique filename, and returns the address of the template.  The template should contain a filename 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. 

INTEGRATED SOLUTIONS 4.3 BSD  —  May 14, 1986

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026