Internationalization and localization tools


String Format Function

int _snscanf(const char *input, size_t length, const char *format [, argument ]...);

int _snwscanf(const wchar_t *input, size_t length, const wchar_t *format [, argument ]...);

int _sntscanf(const TCHAR *input, size_t length, const TCHAR *format [, argument ]...);

Internationalization (I18n) Function Overview

The _snscanf function reads up to length characters from input, into the locations given by argument, under the control of the format specification. The number of converted and assigned fields is returned, or EOF in the event of an error. The behavior of _snscanf is undefined if copying takes place between strings that overlap.

_snwscanf is the wide character version of _snscanf; its arguments are wide-character strings.

_sntscanf is the Windows-only Generic version of the function; with the _MBCS or _UNICODE compiler flags determining its mapping to either _snscanf or _snwscanf.

I18n Issues

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

Prior to calling one of these functions, ensure that the current locale is set properly by calling setlocale, as string formatting is dependent on the LC_NUMERIC locale category. See String Formatting in C and C++ for a discussion on locale-sensitive formatting in internationalized applications.

Special care must be taken with the length parameter. See Locale-Sensitive Length Functions for a complete discussion of the issues involved with functions that pass length parameters.

_snscanf does not support multibyte hexadecimal characters.

_snwscanf does not support Unicode fullwidth hexadecimal characters or characters in the "compatibility zone" which is the range 0xF900 through 0xFFEF.

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