Internationalization and localization tools


Character Manipulation Function

errno_t _itoa_s(int value, char* buffer, size_t sizeInCharacters, int radix);

errno_t _itow_s(int value, wchar_t* buffer, size_t sizeInCharacters, int radix);

errno_t _itot_s(int value, TCHAR* buffer, size_t sizeInCharacters, int radix);

Internationalization (I18n) Function Overview

The _itoa_s function is a secure version of _itoa, performing error checking and returning an error code in the event of an error. It converts the integer value to a null-terminated character string and stores the result (up to 33 single-byte characters) in buffer. radix specifies the base of value and must be in the range 2 - 36. If radix equals 10 and value is negative, the first character of the stored string is the minus sign (-).

_itow_s is the wide-character version of _itoa_s, storing up to 33 wide characters. The sizeInCharacters parameter is in bytes for _itoa_s or words for _itow_s.

_itot_s is the Windows-only Generic version of the function; with the _MBCS or _UNICODE compiler flags determining its mapping to either _itoa_s or _itow_s.

I18n Issues

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

These functions are not locale-dependent and should not be used for negative decimal values, which enforces the placement and symbol of the negative sign, rather than relying on the settings of the user's current locale. Instead, use one of the sprintf functions.

In addition, ensure that sizeInCharacters is correct for the chosen platform. See Locale-Sensitive Length Functions for a discussion on single-byte and wide character sizes.

Recommended Replacements*

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

Character Manipulation Functions

 

Lingoport internationalization and localization services and software