ns_mktemp returns a unique filename based on the template you specify. The string in the template should contain a string with 6 trailing Xs. ns_mktemp will replace the Xs with a letter and the current process id. The letter will be chosen to make the filename unique.
ns_mktemp is analogous to the Unix C library mktemp function.