Internationalization and localization tools


File and Path Function

char *mktemp(char *template);

char *_mktemp(char *template);

wchar_t *_wmktemp(wchar_t *template);

TCHAR *_tmktemp(TCHAR *template);

Internationalization (I18n) Function Overview

The mktemp function creates a unique filename from template, modifying template with the resulting filename and returning a pointer to it. The template argument must point to a string whose last six characters are XXXXXX. These characters will be replaced with characters that make the filename unique. mktemp returns NULL if template is badly formed or there are no more unique names that can be created from the given template.

_mktemp is the same as mktemp, supported on Windows platforms. This function automatically handles multibyte characters, using the current multibyte code page.

Also, on Windows platforms, _wmktemp is the wide-character version of _mktemp; its argument and return value are wide-character strings. There is no ANSI wide-character equivalent.

_tmktemp is the Windows-only Generic version of the function; with the _MBCS or _UNICODE compiler flags determining its mapping to either _mktemp or _wmktemp.

I18n Issues

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

On ANSI platforms, consider using mkstemp rather than mktemp, which is a more secure alternative. Otherwise, on ANSI UTF-16 platforms, use a conversion function to convert the wide-character string to a multibyte-character string and then call mktemp.

The Windows _mktemp 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