Partager via


_ultoa, _ultow (Windows CE 5.0)

Send Feedback

Developing an Application > Microsoft C Run-time Library for Windows CE > Run-time Library Reference

Convert an unsigned long integer to a string.

char *_ultoa( unsigned long value, char *string, int radix );wchar_t *_ultow( unsigned long value, wchar_t *string, int radix );

Parameters

  • value
    Number to be converted.
  • string
    String result.
  • radix
    Base of value.

Return Values

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

Remarks

These functions are supported by all versions of the C run-time libraries.

The _ultoa function converts value to a null-terminated character string and stores the result (up to 33 bytes) in string. 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.

The following table shows generic-text routine mappings for this function.

TCHAR.H Routine _UNICODE Defined
_ultot _ultow

For more information about TCHAR.H routines, see Generic Text Mappings.

Example

Description

This program converts integers of various sizes to strings in various radixes.

Code

#include <stdlib.h>
#include <stdio.h>

void main( void )
{
   char buffer[20];
   int  i = 3445;
   long l = -344115L;
   unsigned long ul = 1234567890UL;

   _itoa( i, buffer, 10 );
   printf( "String of integer %d (radix 10): %s\n", i, buffer );
   _itoa( i, buffer, 16 );
   printf( "String of integer %d (radix 16): 0x%s\n", i, buffer );
   _itoa( i, buffer, 2  );
   printf( "String of integer %d (radix 2): %s\n", i, buffer );

   _ltoa( l, buffer, 16 );
   printf( "String of long int %ld (radix 16): 0x%s\n", l, 
                                                    buffer );

   _ultoa( ul, buffer, 16 );
   printf( "String of unsigned long %lu (radix 16): 0x%s\n", ul,
                                                    buffer );
}
// Output
String of integer 3445 (radix 10): 3445
String of integer 3445 (radix 16): 0xd75
String of integer 3445 (radix 2): 110101110101
String of long int -344115 (radix 16): 0xfffabfcd
String of unsigned long 1234567890 (radix 16): 0x499602d2

Requirements

OS Versions: Windows CE 2.0 and later.

Header: stdlib.h, stdio.h.

Link Library: coredll.dll.

See Also

_itoa | _ltoa

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.