MKTEMP - make a unique string.

(Compatible with UNIX System V C)

Usage:

char *mktemp();
s = mktemp( template );

Where:

char *template;
is a "template" string whose last group of upper case 'X's are to be replaced with other alphabetic characters to form a unique string.
char *s;
points to the template string.

Description:

"mktemp" modifies the string "template" to form a unique string and returns a pointer to "template". The last contiguous series of upper case 'X's will be replaced by other letters. This will form an identifier guaranteed to be unique to the current program (provided enough 'X's are specified).

A frequent use of this function is to generate temporary file names. In any case, the template string must conform to any syntactic requirements of whatever will use the unique string. For example, the template

"fc*XXXXX"

generates a temporary file name that works in TSS, while

"fc*XX"

will generate a temporary file name that works in both batch and TSS.

Notes:

"mktemp" is provided for compatibility with UNIX. New programs should use the ANSI standard "tmpnam".

The unique string is generated by calling _unique, so its uniqueness is limited by the uniqueness of the number returned by _unique.

See Also:

expl c lib tmpnam

expl c lib _unique

Copyright © 1996, Thinkage Ltd.