如何将System :: Int32转换为wchar_t *

时间:2011-05-17 10:35:34

标签: .net visual-c++ c++-cli wchar-t int32

我有这段代码:

int casted_dbValue=3;
wchar_t* nativeData=(wchar_t*)casted_dbValue;

int与const wchar_t*之间的转换不正确。如何处理这个错误?

1 个答案:

答案 0 :(得分:2)

您是否尝试过_itow function

wchar_t * _itow(
                int value,
                wchar_t *str,
                int radix
                );

或者,更安全的版本_itow_s

第一个参数(value)是要转换的整数值,第二个是字符串结果,第三个是数值的基数。它返回一个指向str值的指针。