qc.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
mktemp
 Summary Example                         Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
     The mktemp function creates a unique file name by modifying the
     given <template> argument. The <template> argument has the form
 
          baseXXXXXX
 
     where <base> is the part of the new file name supplied by the user
     and the Xs are placeholders for the part supplied by mktemp. The
     mktemp function preserves <base> and replaces the six trailing Xs
     with an alphanumeric character followed by a five-digit value. The
     alphanumeric character is 0 the first time mktemp is called
     with a given template. The five-digit value is a unique number
     identifying the calling process.
 
     In subsequent calls from the same process with the same template,
     mktemp checks to see if previously returned names have been used
     to create files. If no file exists for a given name, mktemp
     returns that name. If files exist for all previously returned
     names, mktemp creates a new name by replacing the alphanumeric
     character in the name with the next available lowercase letter.
 
     For example, if the first name returned is t012345 and this name
     is used to create a file, the next name returned will be ta12345.
     When creating new names, mktemp uses, in order, '0' and then the
     lowercase letters 'a' to 'z'.
 
     Note that the original template is modified by the first call to
     mktemp. If you then call the mktemp function again with the same
     template (i.e., the original one), you get an error.
 
     The mktemp function generates unique file names but does not
     create or open files.
 
     Return Value
 
     The mktemp function returns a pointer to the modified template.
     The return value is NULL if the template argument is badly formed
     or no more unique names can be created from the given template.
                                    -♦-