Internationalization and localization tools


String Format Function

int _scprintf(char *buffer, const char *format [, argument] ...);

int _scwprintf(wchar_t *buffer, size_t count, const wchar_t *format [, argument] ...);

int _sctprintf(TCHAR *buffer, const TCHAR *format [, argument] ...);

Internationalization (I18n) Function Overview

The _scprintf function returns the number of characters that would be generated if the string were to be printed or sent to a file or buffer using the specified formatting codes. The value returned does not include the terminating null character. _scwprintf performs the same function for wide characters.

_scwprintf is the wide-character version of the function and returns the number of wide characters that would be generated.

_sctprintf is the Windows-only Generic version of the function; with the _MBCS or _UNICODE compiler flags determining its mapping to either _scprintf or _scwprintf.

I18n Issues

Use the appropriate version of the function as required for Windows platform support.

These functions should not be used for strings that are locale-dependent. _scprintf is not dependent on locale, and so numeric values will not be formatted correctly. As for _scwprintf, although it does print Unicode characters and formats according to locale, it uses the current console locale, rather than the current user's locale.

See String Formatting in C and C++ for a discussion on locale-sensitive formatting in internationalized applications.

Recommended Replacements*

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

String Format Functions

 

Lingoport internationalization and localization services and software