Freigeben über


_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*.*

Return Value

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

Remarks

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.

Security noteSecurity Note

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

Requirements

Routine

Required header

_ultoa

<stdlib.h>

_ultow

<stdlib.h> or <wchar.h>

For additional compatibility information, see Compatibility in the Introduction.

Example

See the example for _itoa.

.NET Framework Equivalent

System::Convert::ToString

See Also

Reference

Data Conversion

_itoa, _i64toa, _ui64toa, _itow, _i64tow, _ui64tow