_ultoa, _ultow

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at _ultoa, _ultow.

Convert an unsigned long integer to a string. More secure versions of these functions are available; see _ultoa_s, _ultow_s.

char *_ultoa(  
   unsigned long value,  
   char *str,  
   int radix   
);  
wchar_t *_ultow(  
   unsigned long value,  
   wchar_t *str,  
   int radix   
);  
template <size_t size>  
char *_ultoa(  
   unsigned long value,  
   char (&str)[size],  
   int radix   
); // C++ only  
template <size_t size>  
wchar_t *_ultow(  
   unsigned 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 _ultoa function converts value to a null-terminated character string and stores the result (up to 33 bytes) in str. No overflow checking is performed. radix specifies the base of value; radix must be in the range 2 – 36. _ultow is a wide-character version of _ultoa.

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.

In C++, these functions have template overloads that invoke the newer, secure counterparts of these functions. For more information, see Secure Template Overloads.

Generic-Text Routine Mappings

TCHAR.H routine_UNICODE & _MBCS not defined_MBCS defined_UNICODE defined
_ultot_ultoa_ultoa_ultow
RoutineRequired header
_ultoa<stdlib.h>
_ultow<stdlib.h> or <wchar.h>

For additional compatibility information, see Compatibility in the Introduction.

See the example for _itoa.

System::Convert::ToString

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

Show: