KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q36675: Filename from tmpnam Has Prefix from P_tmpdir

Article: Q36675
Product(s): See article
Version(s): 4.00 5.00 5.10  | 5.10
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | | mspl13_c
Last Modified: 18-OCT-1988

The tmpnam function generates a temporary filename that can be used as
a temporary file. The character string that tmpnam creates consists of
the path prefix defined by the P_tmpdir entry in stdio.h, followed by
a sequence consisting of the digit characters "0" through "9".

This information is in the "Microsoft C 5.1 Optimizing Compiler
Run-Time Library Reference" manual on Page 611. The "Microsoft C 4.00
Run-Time Library Reference" manual does not describe this naming
behavior.

In Version 5.00 and 5.10, the P_tmpdir entry is defined in stdio.h
as follows:

#define P_tmpdir "\\"

In Version 4.00, the P_tmpdir entry is defined in stdio.h as follows:

#define P_tmpdir "\\TMP"

Thus, a string for a temporary filename created under Version 4.00
will have the form \TMP\x (where x is the generated number), and it
will be necessary to have a TMP subdirectory.

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.