_i64toa, _i64tow

De RAD Studio
Aller à : navigation, rechercher

Remonter à math.h - Index


Header File

math.h, stdlib.h

Category

Conversion Routines, Math Routines,

Prototype

char *_i64toa(__int64 value, char *string, int radix);

wchar_t *_i64tow(__int64 value, wchar_t *string, int radix);

Description

_i64toa converts an __int64 to a string. _i64tow is the unicode version. It converts a __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 (-).

Remarque :  The space allocated for string must be large enough to hold the returned string, including the terminating null character (\0). These functions 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 __int64 */
  __int64 d_left = _wtoi64(left);
  __int64 d_right = _wtoi64(right);

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

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


Portability

POSIX Win32 ANSI C ANSI C++

_i64toa

+

_i64tow

+