MKTEMP - make a unique string.

(Compatible with UNIX System V C)


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


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.


"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


generates a temporary file name that works in TSS, while


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


"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 nsc lib tmpnam

expl nsc lib _unique

Copyright © 1996, Thinkage Ltd.