Character Manipulation Function
errno_t _ltoa_s(long value, char* str, size_t sizeOfstr, int radix);
errno_t _ltow_s(long value, wchar_t* str, size_t sizeOfstr, int radix);
errno_t _ltot_s(long value, TCHAR* str, size_t sizeOfstr, int radix);
Internationalization (I18n) Function Overview
The _ltoa_s function is a secure version of _ltoa , performing error checking and returning an error code in the event of an error. It converts the long integer value to a null-terminated character string and stores the result (up to 33 single-byte characters) in str .
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 (-).
_ltow_s is the wide-character version of _ltoa_s , storing up to 33 wide characters. The sizeOfstr parameter is in bytes for _ltoa_s or words for _ltow_s .
_ltot_s is the Windows-only Generic version of the function; with the _MBCS or _UNICODE compiler flags determining its mapping to either _ltoa_s or _ltow_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
|