C++ _itow_s和_ltow_s的用法

C++ _itow_s和_ltow_s的用法,c++,visual-c++,C++,Visual C++,我想在VC8中使用和使用MSVC。但我没有得到传递给这两个API的缓冲区长度 MSDN给了我以下关于“itow”的解释 [in] sizeInCharacters Size of the buffer in single-byte characters or wide characters. 对于 sizeOfstr Size of the str in bytes for _ltoa_s or words for _ltow_s. 所以,如果我将宽字符数WCHAR作为缓冲区的长度传递到这

我想在VC8中使用和使用MSVC。但我没有得到传递给这两个API的缓冲区长度

MSDN给了我以下关于“itow”的解释

[in] sizeInCharacters
Size of the buffer in single-byte characters or wide characters.
对于

sizeOfstr 
Size of the str in bytes for _ltoa_s or words for _ltow_s.
所以,如果我将宽字符数WCHAR作为缓冲区的长度传递到这两个API中(如下所示),这会好吗

WCHAR buf[20];
_itow_s(11L, buf, sizeof(buf)/sizeof(WCHAR), 10);
_ltow_s(11L, buf, sizeof(buf)/sizeof(WCHAR), 10);

_itow_s和_ltow_s希望此参数为WCHARs的长度。您的buf是WCHAR类型,并且您正在传递WCHAR的数量,因此它看起来是正确的。

该语句对所有函数都是通用的,并且由您来推断它的含义。对于这些函数,它是关于WCHAR的。