Internationalization and localization tools


File and Path Function

char *tmpnam(char *string);

wchar_t *_wtmpnam(wchar_t *string);

TCHAR *_ttmpnam(TCHAR *string);

Internationalization (I18n) Function Overview

The tmpnam function creates a unique temporary filename, storing the result in string. It returns a pointer to the string if successful; else NULL. On ANSI platforms, if string is not NULL, then the return pointer is to this buffer; otherwise, an internal static buffer holds the filename and the return points to it. On Windows platforms, the resulting filename is always stored both in the string argument and in the internal static buffer and the return points to it. free does not need to be called to deallocate the internal static buffer.

On Windows MBCS platforms, tmpname automatically handles multibyte-character string arguments as appropriate, recognizing multibyte-character sequences according to the multibyte code page currently in use.

_wtmpnam, supported only on Windows, is the wide version of _tmpnam; its argument and return are wide-character strings.

_ttmpnam is the Windows-only Generic version of the function; with the _MBCS or _UNICODE compiler flags determining its mapping to either _tmpnam or _wtmpnam.

I18n Issues

Use the appropriate version of the function as required for internationalization support, noting the following:

On ANSI UTF-16 platforms, use a conversion function to convert the return from tmpnam to a wide-character string.

In a Windows MBCS application, the tmpnam function depends on the multibyte code page in effect. By default, the multibyte code page is set to the system-default ANSI code page obtained from the operating system at program startup. Use _getmbcp and _setmbcp to query or change the current multibyte code page, respectively.

See Pathnames for a discussion of path and filename considerations in an internationalized application.

Recommended Replacements*

*If you're already using the recommended function, see I18n Issues for other reasons why Globalyzer is detecting the function.

File and Path Functions

 

Lingoport internationalization and localization services and software