_ltoa, _ltow

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

Converts a long integer to a string. More secure versions of these functions are available; see _ltoa_s, _ltow_s.

char *_ltoa(  
   long value,  
   char *str,  
   int radix   
);  
wchar_t *_ltow(  
   long value,  
   wchar_t *str,  
   int radix   
);  
template <size_t size>  
char *_ltoa(  
   long value,  
   char (&str)[size],  
   int radix   
); // C++ only  
template <size_t size>  
wchar_t *_ltow(  
   long value,  
   wchar_t (&str)[size],  
   int radix   
); // C++ only  

Parameters

value
Number to be converted.

str
String result.

radix
Base of value.

Each of these functions returns a pointer to str. There is no error return.

The _ltoa function converts the digits of value to a null-terminated character string and stores the result (up to 33 bytes) in str. The radix argument specifies the base of value, which 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 is a wide-character version of _ltoa; the second argument and return value of _ltow are wide-character strings. Each of these functions is Microsoft-specific.

System_CAPS_ICON_important.jpg Important

To prevent buffer overruns, ensure that the str buffer is large enough to hold the converted digits plus the trailing null-character and a sign character.

In C++, these functions have template overloads. For more information, see Secure Template Overloads.

Generic-Text Routine Mappings

Tchar.h routine_UNICODE and _MBCS not defined_MBCS defined_UNICODE defined
_ltot_ltoa_ltoa_ltow
RoutineRequired header
_ltoa<stdlib.h>
_ltow<stdlib.h>

For more compatibility information, see Compatibility in the Introduction.

See the example for _itoa.

System::Convert::ToString

Data Conversion
_itoa, _i64toa, _ui64toa, _itow, _i64tow, _ui64tow
_ultoa, _ultow

Show: