|
|
1.1 ! root 1: .\" @(#)mktemp.3 6.3 (Berkeley) 4/10/87 ! 2: .\" ! 3: .TH MKTEMP 3 "April 10, 1987" ! 4: .AT 3 ! 5: .SH NAME ! 6: mktemp \- make a unique file name ! 7: .SH SYNOPSIS ! 8: .nf ! 9: .B char *mktemp(template) ! 10: .B char *template; ! 11: .sp ! 12: .B mkstemp(template) ! 13: .B char *template; ! 14: .fi ! 15: .SH DESCRIPTION ! 16: \fIMktemp\fP creates a unique file name and returns the address of ! 17: the template. The template should contain a file name with trailing ! 18: \fIX\fP's, normally something like \fI/tmp/tempXXXXXX\fP. The \fIX\fP's ! 19: are replaced by the current process number and/or a unique letter ! 20: combination. \fIMkstemp\fP makes the same replacement to the template ! 21: but opens the template file and returns a file descriptor open for ! 22: reading and writing. \fIMkstemp\fP avoids the race between testing ! 23: whether the file exists and opening it for use. The number of file ! 24: name combinations \fImktemp\fP and \fImkstemp\fP will try depends on ! 25: the number of \fIX\fP's placed on the end of the template; six \fIX\fP's ! 26: will result in them trying roughly 26 ** 6 combinations. ! 27: .SH "SEE ALSO" ! 28: access(2), getpid(2), open(2) ! 29: .SH DIAGNOSTICS ! 30: \fIMktemp\fP returns NULL on failure, \fImkstemp\fP returns -1 if no ! 31: suitable file could be created.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.