SYNOPSIS
#include <stdlib.h>
char *mkdtemp(char *template);
int mkstemp(char *template);
int mkstemp64(char *template);
int mkstemps(char *template, int suffixlen);
int mkstemps64(char *template, int suffixlen);
char *mktemp(char *template);
DESCRIPTION
The
The
The
The
The
The
The template parameter points to a character buffer containing a null-terminated string. This string consists of contiguous, legal file name characters followed by a contiguous string of Xs. The functions described on this page replace the trailing Xs with an alphanumeric sequence that is chosen to ensure that no file has that name. When there is no path information in template, the current directory is assumed to be where the generated file name will reside. Xs that appear elsewhere in the string are not replaced.
For the
char template[]="tmpfileXXX.txt" mkstemps(template,4)
ignores the final four characters of the strings (in this case, the .txt extension) and replaces the three trailing Xs.
- Note:
-
When using this functionality to specify file extensions as a part of the generated name, the period (.) counts as one of the characters to be ignored. That's why the example above used a suffixlen of 4 to include the .txt extension.
However, consider this case:
char template[]="tmpfileXXX.Xxt" mkstemps(template,2)
Here,
PARAMETERS
- template
-
Points to a buffer containing a null-terminated string used as the template for generating a unique name.
For the
mkstemp() ,mkstemp64() ,mkstemps() ,mkstemps64() , this buffer is also used to store the resulting unique file name. - suffixlen
-
Specifies the length of the suffix to be included in the file name generated by
mkstemps() ormkstemps64() .
RETURN VALUES
On success,
On success,
CONFORMANCE
UNIX 98.
MULTITHREAD SAFETY LEVEL
MT-Safe.
PORTING ISSUES
None.
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
PTC MKS Toolkit 10.4 Documentation Build 39.