DOC: mktemp() Creates a Maximum of 27 Unique Filenames (50351)



The information in this article applies to:

  • The C Run-Time (CRT), when used with:
    • Microsoft C for MS-DOS 5.1
    • Microsoft C for MS-DOS 6.0
    • Microsoft C for MS-DOS 6.0a
    • Microsoft C for MS-DOS 6.0ax
    • Microsoft C/C++ for MS-DOS 7.0
    • Microsoft Visual C++ 1.0
    • Microsoft Visual C++ 1.5
    • Microsoft Visual C++, 32-bit Professional Edition 2.0

This article was previously published under Q50351

SUMMARY

In the Microsoft C online and printed documentation for the mktemp() function, it is not clear exactly how many filenames mktemp() can create. These references state the following:

When creating new names, mktemp uses, in order, "0" and the lowercase letters "a" to "z".

This information is correct. However, the documentation fails to mention that these are the only filenames that are created. Any further calls to mktemp() after these characters have been used will fail (that is, once "z" has been placed in the template). Therefore, the limit on the number of unique filenames that can be created by mktemp() is 27.

NOTE: This problem was fixed in the Books On-line of Microsoft Visual C++, 32-bit Edition, version 4.0.

Modification Type:MajorLast Reviewed:12/12/2003
Keywords:kbCRT kbdocfix KB50351