3 @deftypefn Supplemental char* tmpnam (char *@var{s})
5 This function attempts to create a name for a temporary file, which
6 will be a valid file name yet not exist when @code{tmpnam} checks for
7 it. @var{s} must point to a buffer of at least @code{L_tmpnam} bytes,
8 or be @code{NULL}. Use of this function creates a security risk, and it must
9 not be used in new projects. Use @code{mkstemp} instead.
21 #define P_tmpdir "/usr/tmp"
24 static char tmpnam_buffer[L_tmpnam];
25 static int tmpnam_counter;
27 extern int getpid (void);
37 /* Generate the filename and make sure that there isn't one called
43 sprintf (s, "%s/%s%x.%x", P_tmpdir, "t", pid, tmpnam_counter);