Internationalization and localization tools


File and Path Function

char *tempnam(char *dir, char *prefix);

wchar_t *_tempnam(wchar_t *dir, wchar_t *prefix);

wchar_t *_wtempnam(wchar_t *dir, wchar_t *prefix);

TCHAR *_ttempnam(TCHAR *dir, TCHAR *prefix);

Internationalization (I18n) Function Overview

The tempnam function returns a unique temporary path and filename, using prefix to form the filename and dir for the path. In the event of an error the function returns NULL.

_tempnam is the Windows MBCS function. It automatically handles multibyte-character string arguments as appropriate, recognizing multibyte-character sequences according to the multibyte code page currently in use.

_wtempnam, supported only on Windows, is the wide version of _tempnam; its arguments and return are wide-character strings.

_ttempnam is the Generic version of the function; with the _MBCS or _UNICODE compiler flags determining its mapping to either _tempnam or _wtempnam.

See the MSDN Library for more details, including the rules used in creating the unique filename on Windows systems; and GNU C Library for details and creation rules when using the GCC compiler.

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 wide-character strings to multibyte-character strings and then call tempnam.

In a Windows MBCS application, the _tempnam 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