Win32 API 日本語リファレンス
ホームGlobalization › u_forDigit

u_forDigit

関数
指定基数で数値を表す文字を取得する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

// icuuc.dll
#include <windows.h>

INT u_forDigit(
    INT digit,
    CHAR radix
);

パラメーター

名前方向
digitINTin
radixCHARin

戻り値の型: INT

各言語での呼び出し定義

// icuuc.dll
#include <windows.h>

INT u_forDigit(
    INT digit,
    CHAR radix
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int u_forDigit(
    int digit,   // INT
    sbyte radix   // CHAR
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function u_forDigit(
    digit As Integer,   ' INT
    radix As SByte   ' CHAR
) As Integer
End Function
' digit : INT
' radix : CHAR
Declare PtrSafe Function u_forDigit Lib "icuuc" ( _
    ByVal digit As Long, _
    ByVal radix As Byte) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

u_forDigit = ctypes.cdll.icuuc.u_forDigit
u_forDigit.restype = ctypes.c_int
u_forDigit.argtypes = [
    ctypes.c_int,  # digit : INT
    ctypes.c_byte,  # radix : CHAR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
u_forDigit = Fiddle::Function.new(
  lib['u_forDigit'],
  [
    Fiddle::TYPE_INT,  # digit : INT
    Fiddle::TYPE_CHAR,  # radix : CHAR
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn u_forDigit(
        digit: i32,  // INT
        radix: i8  // CHAR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int u_forDigit(int digit, sbyte radix);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_u_forDigit' -Namespace Win32 -PassThru
# $api::u_forDigit(digit, radix)
#uselib "icuuc.dll"
#func global u_forDigit "u_forDigit" sptr, sptr
; u_forDigit digit, radix   ; 戻り値は stat
; digit : INT -> "sptr"
; radix : CHAR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "icuuc.dll"
#cfunc global u_forDigit "u_forDigit" int, int
; res = u_forDigit(digit, radix)
; digit : INT -> "int"
; radix : CHAR -> "int"
; INT u_forDigit(INT digit, CHAR radix)
#uselib "icuuc.dll"
#cfunc global u_forDigit "u_forDigit" int, int
; res = u_forDigit(digit, radix)
; digit : INT -> "int"
; radix : CHAR -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procu_forDigit = icuuc.NewProc("u_forDigit")
)

// digit (INT), radix (CHAR)
r1, _, err := procu_forDigit.Call(
	uintptr(digit),
	uintptr(radix),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function u_forDigit(
  digit: Integer;   // INT
  radix: Shortint   // CHAR
): Integer; cdecl;
  external 'icuuc.dll' name 'u_forDigit';
result := DllCall("icuuc\u_forDigit"
    , "Int", digit   ; INT
    , "Char", radix   ; CHAR
    , "Cdecl Int")   ; return: INT
●u_forDigit(digit, radix) = DLL("icuuc.dll", "int u_forDigit(int, char)")
# 呼び出し: u_forDigit(digit, radix)
# digit : INT -> "int"
# radix : CHAR -> "char"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。