_itow_s和_ltow_s的用法
Usage of _itow_s and _ltow_s
我想在VC8中使用MSVC的_itow_s和_ltow_s。但是我没有得到什么作为缓冲区的长度传递给这两个api。
MSDN给出了_itow_s
的如下解释[in] sizeInCharacters
Size of the buffer in single-byte characters or wide characters.
为_ltow_s 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
期望此参数为WCHAR
s的长度。您的buf
类型为WCHAR
,并且您正在传递WCHAR
s的数量,因此它看起来是正确的。
相关文章:
- 这个指针在c++中的用法
- 当C++中需要自动删除时,这是静态的正确用法吗?
- libstdc++ 文件系统中未初始化的用法?
- 复制和交换习惯用法与移动操作之间的交互
- 类作用域的类型别名"using":[何时]方法中的用法可以先于类型别名?
- 命名参数习惯用法和(抽象)基类
- 省略号在C++中的所有用法
- () 在 C++ 11 中的特殊而奇怪的用法?
- 构造函数的用法
- 模板类中自动的类用法不完整
- 这里的 = 运算符有什么用法?
- 什么模板用法在阶乘中更好
- 如果可变长度元素的constexpr用法得到<>
- 为什么 setjmp/longjmp 的这种用法是未定义的行为?
- 访问提升:shared_ptr 主范围外崩溃,断言失败:px != 0.指针的正确用法是什么?
- C++ 中函数中 Const 用法之间的差异
- equal_to模板类C++用法
- PCL 中的 GICP 用法
- 向量的正确用法<int>::size_type
- C++命名空间的基本用法