| 1 | .\" @(#)mktemp.3 6.1 (Berkeley) %G% |
| 2 | .\" |
| 3 | .TH MKTEMP 3 "" |
| 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 | .I Mktemp |
| 17 | replaces |
| 18 | .I template |
| 19 | by a unique file name, and returns the |
| 20 | address of the template. |
| 21 | The template should look like a file name with six trailing |
| 22 | X's, which will be replaced with the |
| 23 | current process id and a unique letter. |
| 24 | .I Mkstemp |
| 25 | makes the same replacement to the template but returns an open file descriptor |
| 26 | for the template file suitable for reading or writing. |
| 27 | .I Mkstemp |
| 28 | avoids the potential race between the creation of the unique |
| 29 | file name and its being opened for use. |
| 30 | .SH "SEE ALSO" |
| 31 | getpid(2) |