_i64toa, _i64tow

提供: RAD Studio
移動先: 案内検索

math.h:インデックス への移動


ヘッダーファイル

math.h, stdlib.h

カテゴリ

変換ルーチン,演算ルーチン

プロトタイプ

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

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

説明

_i64toa は,__int64 を文字列に変換します。_i64tow は,Unicode バージョンです。これは,__int64 をワイド文字文字列に変換します。

これらの関数は,value をヌルで終わる文字列に変換し,その結果を string に格納します。value は __int64 です。

radix は,value の変換に使用される基数を指定します。2 ~ 36 の値を指定する必要があります。value が負で,radix が 10 の場合,文字列の最初の文字は負符号(-)になります。

メモ: string に割り当てられた領域には,返される文字列(ヌルターミネータ(\0)を含む)を保持できるだけの十分な大きさが必要です。これらの関数は,最大 33 バイトを返すことができます。

戻り値

string へのポインタを返します。

コード例

#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);
}

移植性

POSIX Win32 ANSI C ANSI C++

_i64toa

+

_i64tow

+