_ui64toa, _ui64tow

From RAD Studio
Jump to: navigation, search

Go Up to stdlib.h Index


Header File

stdlib.h

Category

Conversion Routines, Math Routines

Prototype

char *_ui64toa(unsigned __int64 value, char *string, int radix);

wchar_t *_ui64tow(unsigned __int64 value, wchar_t *string, int radix);

Description

_ui64toa converts an unsigned __int64 to a string.

_ui64tow is the unicode version. _ui64tow converts an unsigned __int64 to a wide-character string.

These functions convert value to a null-terminated string and store the result in string. value is an __int64.

radix specifies the base to be used in converting value; it must be between 2 and 36, inclusive. If value is negative and radix is 10, the first character of string is the minus sign (-).

Note: The space allocated for string must be large enough to hold the returned string, including the terminating null character (\0). Can return up to 33 bytes.

Return Value

Returns a pointer to string.

Example

#include <stdlib.h>
#include <math.h>
wchar_t* add_i64_str(wchar_t* left, wchar_t* right)
{
  /* Transform the input strings into __uint64 */
  __uint64 d_left = _wtoi64(left);
  __uint64 d_right = _wtoi64(right);

  /* Allocate enough space */
  wchar_t* result = (wchar_t*)malloc(sizeof(wchar_t) * 64);

  /* Return the summed values */
  _ui64tow(d_left + d_right, result, 10);
}

Portability

POSIX Win32 ANSI C ANSI C++

_ui64toa

_ui64tow

+