Internationalization and localization tools


String Format Function

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

int wscanf(const wchar_t *format [, argument ]...);

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

Internationalization (I18n) Function Overview

The scanf function reads input from stdin 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. If an end-of-file condition is detected before any matches are performed, including matches against whitespace and literal characters in the template, then EOF is returned. The behavior of scanf is undefined if copying takes place between strings that overlap.

wscanf is the wide character version of scanf; its format argument is a wide-character string.

_tscanf is the Windows-only Generic version of the function; with the _MBCS or _UNICODE compiler flags determining its mapping to either scanf or wscanf.

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.

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